Skip to content
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
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

lolrobbe2
Copy link
Contributor

@lolrobbe2 lolrobbe2 commented Oct 7, 2024

What does this PR do?

Add support for setting .NET sdk using dotnetsdk option. (only on new format projects otherwise just use the defautl)

Web
Razor
Worker
Blazor (BlazorWebAssembly)
WindowsDesktop
default (Microsoft.NET.Sdk)

How does this PR change Premake's behavior?

adds a new option called dotnetsdk

Anything else we should know?

Add any other context about your changes here.

Did you check all the boxes?

  • Focus on a single fix or feature; remove any unrelated formatting or code changes
  • Add unit tests showing fix or feature works; all tests pass
  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • Follow our coding conventions
  • Minimize the number of commits
  • Align documentation to your changes

You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!

for some reason it took the commits from my previous pr (add C# documentation file to) i didn't change these files tho!

closes #2288

robbe beernaert and others added 30 commits June 29, 2023 17:49
(functional result stays the same)
modules/vstudio/vs2005_dotnetbase.lua Outdated Show resolved Hide resolved
modules/vstudio/vs2005_dotnetbase.lua Outdated Show resolved Hide resolved
modules/vstudio/vs2005_dotnetbase.lua Outdated Show resolved Hide resolved
src/_premake_init.lua Outdated Show resolved Hide resolved


## mstest ##
to make the MSTest sdk work you need to add the version to `global.json`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to generate that file too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i was thinking about that but how would i make it so you could specify the version? or do i just have a default version and tell people where they can change it! and code for writing the file as i am not familliar with the file api's of premake

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it is adapted but something like MSTest-3.6.1 might be an option
if version are limited, you might hard-code them, else extract version after '-' is also possible.

lolrobbe2 and others added 2 commits October 8, 2024 19:12
…tion to new dedecated function!

(global.json file writing not workin)
@lolrobbe2 lolrobbe2 requested a review from Jarod42 October 8, 2024 17:43
Beernaert Robbe added 2 commits October 8, 2024 19:59
also made it so it does not overwrite global.json when it already exists potentially overwriting variables
src/_premake_init.lua Outdated Show resolved Hide resolved
modules/vstudio/vs2005_dotnetbase.lua Outdated Show resolved Hide resolved
modules/vstudio/vs2005_dotnetbase.lua Outdated Show resolved Hide resolved
website/docs/dotnetsdk.md Outdated Show resolved Hide resolved
website/docs/dotnetsdk.md Outdated Show resolved Hide resolved


## mstest ##
to make the MSTest sdk work you need to add the version to `global.json`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to make the MSTest sdk work you need to add the version to `global.json`:
To make the MSTest SDK work you need to add the version to `global.json`:

Also, according to this you don't need to use global.json, you can have the version in the .csproj with the SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that is correct but specifiying it becomes a little hard so i decided on the global.json route

}
```
:::warning
`global.json` needs to be located in the same folder as your solution
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`global.json` needs to be located in the same folder as your solution
`global.json` needs to be located in the same folder as your solution.

Visual studio is the only toolset currently supported.

### Examples ###
use the web sdk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description is unnecessary, the example is self-documenting.

@@ -0,0 +1,101 @@
--
-- tests/actions/vstudio/cs2005/test_dotnetsdk.lua
-- Test DocumentationFile feature Visual Studio 2005+ C# project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't updated.

modules/vstudio/tests/cs2005/test_dotnetsdk.lua Outdated Show resolved Hide resolved
modules/vstudio/vs2005_dotnetbase.lua Outdated Show resolved Hide resolved
modules/vstudio/vs2005_dotnetbase.lua Outdated Show resolved Hide resolved
website/docs/dotnetsdk.md Outdated Show resolved Hide resolved
src/_premake_init.lua Outdated Show resolved Hide resolved
@lolrobbe2 lolrobbe2 requested a review from Jarod42 October 9, 2024 13:21
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
]]
end
function suite.testMSTest()
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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...

Copy link
Contributor Author

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?

@lolrobbe2 lolrobbe2 requested a review from Jarod42 October 9, 2024 14:54
Beernaert Robbe added 2 commits October 9, 2024 18:11
…in test case but is written in normal ussage
…ause the file is created fine when using in non test environment!

also tried changing dir to _TESTS_DIR to no avail.
@lolrobbe2
Copy link
Contributor Author

Could it be that tests are blocked from creating files? wich would explain why the file is not found!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants