Skip to content

dotnet build/publish uses the implicit SDK RID for RID-specific apps by default #23539

Closed
@richlander

Description

@richlander

dotnet 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 #22314.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions