-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
RuntimeIdentifier
in project is not respected when building/publishing as self-contained
#25062
Comments
Verified on 6.0.200 vs 7.0.100-preview.5 builds. We should fix this for a 6.0.xxx release. Workaround is to explicitly specify a RID on the commandline, either via |
@baronfel Hi!
It's the simplest solution but it's a breaking change. Also, we can parse csproj and try to find a RID but it's even sound complicated =) What do you think? |
We're actively moving away from your suggested plan with designs like #26028 - the SDK has a concept of an 'implicit RID', meaning the RID that corresponds to the platform that the user is running on. You can see this in the existing I think that @nagilson will end up fixing this issue when he does #26028, because the core problem of this issue is that the CLI is doing RID assignment. If we push RID assignment down into the targets entirely and remove the SDK's explicit assignment (as is the current plan for #26028), then this issue should be resolved implicitly. |
Totally agree with you. It would be better solution. |
The linked issue was fixed in 7.0.100 so closing this out. |
@marcpopMSFT sorry, I don't understand. Could you link an issue or PR where this issue is resolved? Just for history. |
Describe the bug
RuntimeIdentifier
in project file is ignored when building/publishing usingdotnet build --self-contained
ordotnet publish --self-contained
. The runtime identifier of the SDK is always used.To Reproduce
RuntimeIdentifier
that is not the same as the SDK you are using. For example, when using a Windows x64 SDK, specify:<RuntimeIdentifier>win-x86</RuntimeIdentifier>
dotnet build --self-contained
dotnet publish --self-contained
Expected: The application is built/published using the RID specified in the project -
win-x86
.Actual: The application is built/published using the RID of the SDK -
win-x64
- not the one explicitly set in the project.Further technical details
For the repro steps above, MSBuild ends up invoked with:
-property:RuntimeIdentifier=win-x64 -property:_CommandLineDefinedRuntimeIdentifier=true
The SDK is explicitly adding the
RuntimeIdentifier
property on the command line if self-contained is specified on the command line, but the runtime identifier is not. As a result, the SDK's RID is used, overriding any settings in the project.sdk/src/Cli/dotnet/CommonOptions.cs
Lines 260 to 264 in a2c34bb
Environment info:
This is a regression from 6.0.
We hit this trying to update the runtime repo to a newer SDK: dotnet/runtime#67771
The text was updated successfully, but these errors were encountered: