-
-
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
Conversation
(functional result stays the same)
|
Tests failed:
|
Co-authored-by: Joris Dauphin <[email protected]>
|
Can you resolve the merge conflict? |
|
update: i think the issue is with the fact that it does not do dictionary values: so the solution would probaly be to have a portion where it handles the dictionary values because if i looked it up right ipairs only returns the indexed pairs api.register snippet in _preload p.api.register {
name = "dotnetsdk",
scope = "project",
kind = "string",
allowed = {
"Default",
"Web",
"Razor",
"Worker",
"Blazor",
"WindowsDesktop",
"MSTest",
dynamicValidator = function (value)
-- value is expected to be in the format <sdk>/<version>
local parts = value:explode("/", true, 1)
local sdk = parts[1] or value
if parts and #parts == 2 then
if p.api.checkValue(p.field.get("dotnetsdk"), parts[1], "string") then
return value
end
end
return nil
end
}
}api.register snippet:for i, item in ipairs(field.allowed) do
if type(item) == "string" then
field.allowed[item:lower()] = item
end
endapi.addAllowedfunction api.addAllowed(fieldName, value)
local field = p.field.get(fieldName)
if not field then
error("No such field: " .. fieldName, 2)
end
if type(value) == "table" then
for i, item in ipairs(value) do
api.addAllowed(fieldName, item)
end
else
field.allowed = field.allowed or {}
-- If we are trying to add where the current value is a function,
-- put the function in a table
if type(field.allowed) == "function" then
field.allowed = { field.allowed }
end
if field.allowed[value:lower()] == nil then
table.insert(field.allowed, value)
field.allowed[value:lower()] = value
end
end
end |
maby obfuscate the key a bit more.
samsinsane
left a comment
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.
There are still outstanding changes requested from previous reviews.
|
all outstanding changes should be fixed. |
@samsinsane all outstanding changes should have been take care of. |

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?
closes #XXXXin comment to auto-close issue when PR is merged)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