-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
.NET C# no way to enable different .NET sdk's on .netcore projects! #2289
Open
lolrobbe2
wants to merge
54
commits into
premake:master
Choose a base branch
from
lolrobbe2:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
34a8b7b
added C# documentationFile feature
42128d0
wrote unit tests for C# documentationFile
753b78e
removed null opt to not enable documentationFile
c74f42f
add documentationFile documentation
3c168d9
add documentationFile documentation
6a5bee2
resolve merge confflict with documentation
3c60b2c
added some extra info for custom dir
aa6bac0
implemented comments
faae641
fixed title
17a9b04
fixed spelling + addd test
ac1b8cb
fixed spelling + addd test
652ab29
Merge branch 'master' of https://github.com/lolrobbe2/premake-core
a228108
improved grammar / capitalization
fe84d57
changed styling of the documentation
e831595
changed docs to fit api
dbd70b5
added MSFT links to See Also
19715dd
fixed capitalization
ce31e60
changed wording/ capitalization of documentation
40167fe
removed the slashes!
9707d8f
added documenationfile to the sidebar
3533b2a
Rename documentationFile.md to documentationfile.md
lolrobbe2 36903cc
merged from master
f50609c
added support for newer <GenerateDocumentationFile> tag
912aac2
Merge branch 'master' of https://github.com/premake/premake-core
44165f5
changed tests
ef4ac4d
changed default from documentationfile "" to documentationfile(true)
3ec3b33
changed documentation to match!
28374f7
changed availability in docs for documentationfile.md
1946ed0
Merge branch 'master' of https://github.com/premake/premake-core
d0bd40f
added support to select .NET sdk in visual studio.
29fe49f
updated sidebar.js
8cf3ccc
added comma!
63964d8
use map instead of ugly if else statement.
lolrobbe2 76b9709
tried to cleanup projectElement function to extract the wpf sdk selec…
b409321
put the api.register next to dotnetframework register function
67b90c3
figured out the file logic
e0a4f80
implemented feedback from samsinsane
06ce5b6
added a test for WPF flag
bff0fa9
updated the dotnetsk options in the docs
3698bec
fixed WindowsDesktop type and added Default to docs
566a587
implemented feedback from Jarod42
9fe2531
added test but test is not fully correct because file is not written …
1a25b9f
at this point when running tests file creation is blocked i think bec…
d30ae4c
removed the global.json test and put a warning comment in the appropr…
31e5606
premake.generate is kinda working as intended but the test part not s…
6a8abbc
fixed the testMSTestGlobalJSON (thanks jarod for the help!)
b36e1a0
fixed the indentation
8f11868
forgot to fix the indentation
0243b80
made global.json look a bit better for endusers.
1338f3a
the desired flow for global.json is working but the test is not worki…
e17721f
implemented feedback from jarod
32cba9e
fixed thr broken global.json test
511df68
Merge branch 'premake:master' into master
lolrobbe2 9dd9591
Merge branch 'premake:master' into master
lolrobbe2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,145 @@ | ||
-- | ||
-- 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 | ||
-- | ||
local p = premake | ||
local suite = test.declare("vstudio_cs2005_dotnetsdk") | ||
local dn2005 = p.vstudio.dotnetbase | ||
-- | ||
-- Setup | ||
-- | ||
|
||
local wks, prj, cwd | ||
|
||
-- | ||
-- Setup and teardown | ||
-- | ||
function suite.setup() | ||
cwd = os.getcwd() | ||
os.chdir(_TESTS_DIR) | ||
|
||
p.action.set("vs2010") | ||
wks = test.createWorkspace() | ||
configurations { "Debug", "Release" } | ||
language "C#" | ||
dotnetframework "net8.0" | ||
end | ||
|
||
function suite.teardown() | ||
os.chdir(cwd) | ||
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 "Web" | ||
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" | ||
setConfig() | ||
|
||
test.capture [[ | ||
<Project Sdk="MSTest.Sdk"> | ||
]] | ||
end | ||
|
||
function suite.testWPFFlag() | ||
prepare() | ||
dotnetsdk "Web" | ||
flags { "WPF" } | ||
setConfig() | ||
|
||
test.capture [[ | ||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> | ||
]] | ||
end | ||
|
||
function suite.testMSTestGlobalJSON() | ||
prepare() | ||
local cfg = test.getconfig(prj, "Debug") | ||
prj.dotnetsdk = "MSTest" | ||
dn2005.output_global_json(prj) | ||
test.capture[[{"msbuild-sdks":{"MSTest.Sdk": "3.6.1"}}]] | ||
end | ||
|
||
function suite.testMSTestGlobalJSONExists() | ||
prepare() | ||
local cfg = test.getconfig(prj, "Debug") | ||
prj.dotnetsdk = "MSTest" | ||
p.generate(prj, path.join(prj.workspace.location, "global.json"), function() p.outln('{"test":"global"') end) | ||
dn2005.output_global_json(prj) | ||
test.capture[[{"test":"global","msbuild-sdks":{"MSTest.Sdk": "3.6.1"}}]] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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) | ||
|
||
|
||
## mstest ## | ||
SDK used for MSTest is `"3.6.1"`, to use another version create or update global.json near the solution. | ||
### Applies To ### | ||
|
||
Project configurations. | ||
|
||
### Availability ### | ||
|
||
Premake 5.0 beta3 or later. | ||
|
||
Visual studio is the only toolset currently supported. | ||
|
||
### Examples ### | ||
```lua | ||
dotnetsdk "Web" | ||
``` |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global.json part is not tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how would i go about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
dotnetbase.netcore.dotnetsdk
would be misplaced...There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I though about
premake.generate
, something like:That way,
generate_global_json_content
can be tested.User is notified of the creation of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i got this far but it seems the content is not getting captured properly