-
-
Notifications
You must be signed in to change notification settings - Fork 640
.NET C# no way to enable different .NET sdk's on .netcore projects! #2289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 64 commits
34a8b7b
42128d0
753b78e
c74f42f
3c168d9
6a5bee2
3c60b2c
aa6bac0
faae641
17a9b04
ac1b8cb
652ab29
a228108
fe84d57
e831595
dbd70b5
19715dd
ce31e60
40167fe
9707d8f
3533b2a
36903cc
f50609c
912aac2
44165f5
ef4ac4d
3ec3b33
28374f7
1946ed0
d0bd40f
29fe49f
8cf3ccc
63964d8
76b9709
b409321
67b90c3
e0a4f80
06ce5b6
bff0fa9
3698bec
566a587
9fe2531
1a25b9f
d30ae4c
31e5606
6a8abbc
b36e1a0
8f11868
0243b80
1338f3a
e17721f
32cba9e
511df68
9dd9591
1c81c86
83a9cae
8099d0f
c76940b
06ee29e
4b0eb5a
1cdac64
f46c5e6
cc6c8ae
ff88efc
77f5d08
e707056
facb727
9c7f6e4
6223a4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| -- | ||
| -- tests/actions/vstudio/cs2005/test_dotnetsdk.lua | ||
| -- Test DotnetSDK feature Visual Studio 2005+ C# project. | ||
| -- Copyright (c) 2012-2024 Jason Perkins and the Premake project | ||
lolrobbe2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| -- | ||
| local p = premake | ||
| local suite = test.declare("vstudio_cs2005_dotnetsdk") | ||
| local dn2005 = p.vstudio.dotnetbase | ||
| -- | ||
| -- Setup | ||
| -- | ||
|
|
||
| local wks, prj | ||
|
|
||
| -- | ||
| -- Setup and teardown | ||
| -- | ||
| function suite.setup() | ||
| p.action.set("vs2010") | ||
| wks = test.createWorkspace() | ||
| configurations { "Debug", "Release" } | ||
| language "C#" | ||
| dotnetframework "net8.0" | ||
| end | ||
|
|
||
| local function setConfig() | ||
| local cfg = test.getconfig(prj, "Debug") | ||
| dn2005.projectElement(cfg); | ||
| end | ||
|
|
||
| local function prepare() | ||
| prj = test.getproject(wks, 1) | ||
| end | ||
|
|
||
| function suite.testNone() | ||
| prepare() | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testDefault() | ||
| prepare() | ||
| setConfig() | ||
| dotnetsdk "Default" | ||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testWeb() | ||
| prepare() | ||
| dotnetsdk "Web" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testRazor() | ||
| prepare() | ||
| dotnetsdk "Razor" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testWorker() | ||
| prepare() | ||
| dotnetsdk "Worker" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.Worker"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testBlazor() | ||
| prepare() | ||
| dotnetsdk "Blazor" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testWindowsDesktop() | ||
| prepare() | ||
| dotnetsdk "WindowsDesktop" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testMSTest() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. global.json part is not tested
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how would i go about that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue is probably that global.json doesn't follow other file generation and so
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would you happen to know where i can find another example of this file generating?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I though about local content = p.capture(function() generate_global_json_content(prj) end)
if content ~= nil and #content > 0 then
p.generate(prj, "global.json", function() p.outln(content) end)
endThat way,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i got premake.generate to work except the test is not working probably somthing stupid that i am missing!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| prepare() | ||
| dotnetsdk "MSTest/3.4.0" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="MSTest.Sdk/3.4.0"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testWPFFlag() | ||
| prepare() | ||
| flags { "WPF" } | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testWebVersion() | ||
| prepare() | ||
| dotnetsdk "Web/3.4.0" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web/3.4.0"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testRazorVersion() | ||
| prepare() | ||
| dotnetsdk "Razor/3.4.0" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.Razor/3.4.0"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testWorkerVersion() | ||
| prepare() | ||
| dotnetsdk "Worker/3.4.0" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.Worker/3.4.0"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testBlazorVersion() | ||
| prepare() | ||
| dotnetsdk "Blazor/3.4.0" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly/3.4.0"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testWindowsDesktopVersion() | ||
| prepare() | ||
| dotnetsdk "WindowsDesktop/3.4.0" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop/3.4.0"> | ||
| ]] | ||
| end | ||
|
|
||
| function suite.testCustomSDKVersion() | ||
| prepare() | ||
| premake.api.addAllowed("dotnetsdk", "CustomSdk") | ||
| dotnetsdk "CustomSdk/3.4.0" | ||
| setConfig() | ||
|
|
||
| test.capture [[ | ||
| <Project Sdk="CustomSdk/3.4.0"> | ||
| ]] | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| Selects a .NET SDK | ||
|
|
||
| ```lua | ||
| dotnetsdk "SDK" | ||
| ``` | ||
|
|
||
| For more information see the MSDN documentation [here](https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview) | ||
|
|
||
| ## parameters ## | ||
lolrobbe2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `SDK` is one of: | ||
|
|
||
| * [Default](https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props) | ||
| * [Web](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/web-sdk?toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json) | ||
| * [Razor](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/sdk?toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json) | ||
| * [Worker](https://learn.microsoft.com/en-us/dotnet/core/extensions/workers) | ||
| * [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) | ||
| * [WindowsDesktop](https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props-desktop?view=aspnetcore-8.0) | ||
| * [MSTest](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-mstest-sdk) | ||
|
|
||
|
|
||
| ## mstest ## | ||
| when using MSTest sdk a version has to be specified! | ||
lolrobbe2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ### Applies To ### | ||
|
|
||
| Project configurations. | ||
|
|
||
| ### Availability ### | ||
|
|
||
| Premake 5.0 beta4 or later. | ||
lolrobbe2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Visual studio is the only toolset currently supported. | ||
|
|
||
| ### Examples ### | ||
| ```lua | ||
| dotnetsdk "Web" | ||
| ``` | ||
|
|
||
| ```lua | ||
| dotnetsdk "Web/3.4.0" | ||
|
|
||
| ``` | ||
lolrobbe2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ## CustomSDK | ||
|
|
||
| ```lua | ||
| premake.api.addAllowed("dotnetsdk", "CustomSDK") -- add the customSDK to allowed values for dotnetsdk | ||
| dotnetsdk "CustomSDK/3.4.0" | ||
| ``` | ||
|
|
||
| ```lua | ||
| premake.api.addAllowed("dotnetsdk", "CustomSDK") -- add the customSDK to allowed values for dotnetsdk | ||
| dotnetsdk "CustomSDK" | ||
| ``` | ||
lolrobbe2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||

Uh oh!
There was an error while loading. Please reload this page.