dotnet build/publish uses the implicit SDK RID for RID-specific apps by default
See original GitHub issuedotnet build/publish uses the implicit SDK RID for RID-specific apps by default
Proposal: .NET SDK uses the implicit Runtime Identifier (RID) in each case when a RID is required but isn’t specified by the user. It should affect (at least) the following dotnet
commands:
build
publish
run
We should validate where --self-contained
is supported/valid. Wherever it is valid, this behavior change should be made.
Example: The following example (console app template) should not fail, but succeed (using the implicit SDK RID). This failure isn’t useful (it doesn’t protect the user from anything scary).
PS C:\Users\rich\app3> dotnet build --self-contained
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(150,5): error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false. [C:\Users\rich\app3\app3.csproj]
Build FAILED.
Note: Part of this feature was implemented in https://github.com/dotnet/sdk/pull/22314.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:16 (14 by maintainers)
Top Results From Across the Web
dotnet publish command - .NET CLI
dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system.
Read more >dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >Runtime-specific apps no longer self-contained - .NET
Learn about a breaking change in the .NET 8 SDK where apps that specify a runtime identifier are no longer self-contained by default....
Read more >Automatic RuntimeIdentifier for publish only - .NET
Learn about a breaking change in the .NET 7 SDK where a RuntimeIdentifier is automatically added to projects only for the dotnet publish...
Read more >MSBuild reference for .NET SDK projects
Use the NetStandardImplicitPackageVersion property when you want to specify a framework version that's lower than the metapackage version.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be resolved in the release/7.0.1xx branch now. (https://github.com/dotnet/sdk/pull/26143) I’d imagine it will flow into rc-2 within a week or two. Please let me know if you encounter any issues. Elsewise we can mark this as resolved! Thanks for working with us to improve the end user experience
I wrote a mini-spec on FDD + (implicit) RID-specific apps at https://github.com/dotnet/sdk/issues/26031