|
| 1 | +-- |
| 2 | +-- tests/actions/vstudio/cs2005/test_dotnetsdk.lua |
| 3 | +-- Test DotnetSDK feature Visual Studio 2005+ C# project. |
| 4 | +-- Copyright (c) 2012-2025 Jason Perkins and the Premake project |
| 5 | +-- |
| 6 | + local p = premake |
| 7 | + local suite = test.declare("vstudio_cs2005_dotnetsdk") |
| 8 | + local dn2005 = p.vstudio.dotnetbase |
| 9 | +-- |
| 10 | +-- Setup |
| 11 | +-- |
| 12 | + |
| 13 | + local wks, prj |
| 14 | + |
| 15 | +-- |
| 16 | +-- Setup and teardown |
| 17 | +-- |
| 18 | + function suite.setup() |
| 19 | + p.action.set("vs2010") |
| 20 | + wks = test.createWorkspace() |
| 21 | + configurations { "Debug", "Release" } |
| 22 | + language "C#" |
| 23 | + dotnetframework "net8.0" |
| 24 | + end |
| 25 | + |
| 26 | + local function setConfig() |
| 27 | + local cfg = test.getconfig(prj, "Debug") |
| 28 | + dn2005.projectElement(cfg); |
| 29 | + end |
| 30 | + |
| 31 | + local function prepare() |
| 32 | + prj = test.getproject(wks, 1) |
| 33 | + end |
| 34 | + |
| 35 | + function suite.testNone() |
| 36 | + prepare() |
| 37 | + setConfig() |
| 38 | + |
| 39 | + test.capture [[ |
| 40 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 41 | + ]] |
| 42 | + end |
| 43 | + |
| 44 | + function suite.testDefault() |
| 45 | + prepare() |
| 46 | + setConfig() |
| 47 | + dotnetsdk "Default" |
| 48 | + test.capture [[ |
| 49 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 50 | + ]] |
| 51 | + end |
| 52 | + |
| 53 | + function suite.testWeb() |
| 54 | + prepare() |
| 55 | + dotnetsdk "Web" |
| 56 | + setConfig() |
| 57 | + |
| 58 | + test.capture [[ |
| 59 | +<Project Sdk="Microsoft.NET.Sdk.Web"> |
| 60 | + ]] |
| 61 | + end |
| 62 | + |
| 63 | + function suite.testRazor() |
| 64 | + prepare() |
| 65 | + dotnetsdk "Razor" |
| 66 | + setConfig() |
| 67 | + |
| 68 | + test.capture [[ |
| 69 | +<Project Sdk="Microsoft.NET.Sdk.Razor"> |
| 70 | + ]] |
| 71 | + end |
| 72 | + |
| 73 | + function suite.testWorker() |
| 74 | + prepare() |
| 75 | + dotnetsdk "Worker" |
| 76 | + setConfig() |
| 77 | + |
| 78 | + test.capture [[ |
| 79 | +<Project Sdk="Microsoft.NET.Sdk.Worker"> |
| 80 | + ]] |
| 81 | + end |
| 82 | + |
| 83 | + function suite.testBlazor() |
| 84 | + prepare() |
| 85 | + dotnetsdk "Blazor" |
| 86 | + setConfig() |
| 87 | + |
| 88 | + test.capture [[ |
| 89 | +<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> |
| 90 | + ]] |
| 91 | + end |
| 92 | + |
| 93 | + function suite.testWindowsDesktop() |
| 94 | + prepare() |
| 95 | + dotnetsdk "WindowsDesktop" |
| 96 | + setConfig() |
| 97 | + |
| 98 | + test.capture [[ |
| 99 | +<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> |
| 100 | + ]] |
| 101 | + end |
| 102 | + |
| 103 | + function suite.testMSTest() |
| 104 | + prepare() |
| 105 | + dotnetsdk "MSTest/3.4.0" |
| 106 | + setConfig() |
| 107 | + |
| 108 | + test.capture [[ |
| 109 | +<Project Sdk="MSTest.Sdk/3.4.0"> |
| 110 | + ]] |
| 111 | + end |
| 112 | + |
| 113 | + function suite.testWPFFlag() |
| 114 | + prepare() |
| 115 | + flags { "WPF" } |
| 116 | + setConfig() |
| 117 | + |
| 118 | + test.capture [[ |
| 119 | +<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> |
| 120 | + ]] |
| 121 | + end |
| 122 | + |
| 123 | + function suite.testWebVersion() |
| 124 | + prepare() |
| 125 | + dotnetsdk "Web/3.4.0" |
| 126 | + setConfig() |
| 127 | + |
| 128 | + test.capture [[ |
| 129 | +<Project Sdk="Microsoft.NET.Sdk.Web/3.4.0"> |
| 130 | + ]] |
| 131 | + end |
| 132 | + |
| 133 | + function suite.testRazorVersion() |
| 134 | + prepare() |
| 135 | + dotnetsdk "Razor/3.4.0" |
| 136 | + setConfig() |
| 137 | + |
| 138 | + test.capture [[ |
| 139 | +<Project Sdk="Microsoft.NET.Sdk.Razor/3.4.0"> |
| 140 | + ]] |
| 141 | + end |
| 142 | + |
| 143 | + function suite.testWorkerVersion() |
| 144 | + prepare() |
| 145 | + dotnetsdk "Worker/3.4.0" |
| 146 | + setConfig() |
| 147 | + |
| 148 | + test.capture [[ |
| 149 | +<Project Sdk="Microsoft.NET.Sdk.Worker/3.4.0"> |
| 150 | + ]] |
| 151 | + end |
| 152 | + |
| 153 | + function suite.testBlazorVersion() |
| 154 | + prepare() |
| 155 | + dotnetsdk "Blazor/3.4.0" |
| 156 | + setConfig() |
| 157 | + |
| 158 | + test.capture [[ |
| 159 | +<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly/3.4.0"> |
| 160 | + ]] |
| 161 | + end |
| 162 | + |
| 163 | + function suite.testWindowsDesktopVersion() |
| 164 | + prepare() |
| 165 | + dotnetsdk "WindowsDesktop/3.4.0" |
| 166 | + setConfig() |
| 167 | + |
| 168 | + test.capture [[ |
| 169 | +<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop/3.4.0"> |
| 170 | + ]] |
| 171 | + end |
| 172 | + |
| 173 | + function suite.testCustomSDKVersion() |
| 174 | + prepare() |
| 175 | + premake.api.addAllowed("dotnetsdk", "CustomSdk") |
| 176 | + dotnetsdk "CustomSdk/3.4.0" |
| 177 | + setConfig() |
| 178 | + |
| 179 | + test.capture [[ |
| 180 | +<Project Sdk="CustomSdk/3.4.0"> |
| 181 | + ]] |
| 182 | + end |
0 commit comments