-
-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.NET C# no way to enable different .NET sdk's on .netcore projects! (#…
…2289) * added C# documentationFile feature * wrote unit tests for C# documentationFile * removed null opt to not enable documentationFile * add documentationFile documentation * add documentationFile documentation * added some extra info for custom dir * implemented comments * fixed title * fixed spelling + addd test * fixed spelling + addd test * improved grammar / capitalization * changed styling of the documentation * changed docs to fit api * added MSFT links to See Also * fixed capitalization * changed wording/ capitalization of documentation * removed the slashes! * added documenationfile to the sidebar * Rename documentationFile.md to documentationfile.md * added support for newer <GenerateDocumentationFile> tag (functional result stays the same) * changed tests * changed default from documentationfile "" to documentationfile(true) * changed documentation to match! * changed availability in docs for documentationfile.md * added support to select .NET sdk in visual studio. * updated sidebar.js * added comma! * use map instead of ugly if else statement. Co-authored-by: Joris Dauphin <[email protected]> * tried to cleanup projectElement function to extract the wpf sdk selection to new dedecated function! (global.json file writing not workin) * put the api.register next to dotnetframework register function * figured out the file logic also made it so it does not overwrite global.json when it already exists potentially overwriting variables * implemented feedback from samsinsane * added a test for WPF flag * updated the dotnetsk options in the docs * fixed WindowsDesktop type and added Default to docs * implemented feedback from Jarod42 * added test but test is not fully correct because file is not written in test case but is written in normal ussage * at this point when running tests file creation is blocked i think because the file is created fine when using in non test environment! also tried changing dir to _TESTS_DIR to no avail. * removed the global.json test and put a warning comment in the appropriate place as file writing is working * premake.generate is kinda working as intended but the test part not so much! * fixed the testMSTestGlobalJSON (thanks jarod for the help!) * fixed the indentation * forgot to fix the indentation * made global.json look a bit better for endusers. * the desired flow for global.json is working but the test is not working due to using p.generate twice! * implemented feedback from jarod * fixed thr broken global.json test * updated dotnetsdk to now accept version localy and removed global.json file generation * updated docs * fixed code formating! * added dynamicvallidator type to api.lua * the dynamicvallidator function is working now * updated documentation to show how to add custom sdk's * deprecated WPF flag * removed cwd Co-authored-by: Joris Dauphin <[email protected]> * this made it work and supports multiple functions. maby obfuscate the key a bit more. * things suddenly seem to work * removed unused code --------- Co-authored-by: robbe beernaert <[email protected]> Co-authored-by: Beernaert Robbe <[email protected]> Co-authored-by: Joris Dauphin <[email protected]>
- Loading branch information
1 parent
1420eae
commit baa0e37
Showing
9 changed files
with
297 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-2025 Jason Perkins and the Premake project | ||
-- | ||
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() | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 ## | ||
`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): Requires a version be specified. | ||
|
||
### Applies To ### | ||
|
||
Project configurations. | ||
|
||
### Availability ### | ||
|
||
Premake 5.0 beta5 or later. | ||
|
||
Visual studio is the only toolset currently supported. | ||
|
||
### Examples ### | ||
```lua | ||
dotnetsdk "Web" | ||
``` | ||
|
||
```lua | ||
dotnetsdk "Web/3.4.0" | ||
``` | ||
|
||
A custom SDK can be specified using the following: | ||
```lua | ||
premake.api.addAllowed("dotnetsdk", "CustomSDK") -- add the custom SDK to allowed values for dotnetsdk | ||
dotnetsdk "CustomSDK" | ||
|
||
dotnetsdk "CustomSDK/3.4.0" -- Specifying a version with a custom SDK is also supported | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters