Skip to content

Enable implicit RID with --sc #21405

Closed
@richlander

Description

@richlander

The new --sc syntax works for self-contained apps, per #19681.

It still requires a RID. Let's enable it to work with the implicit SDK RID so that we don't create a breaking change in .NET 7. This argument is new. It also will enable users to get around the new warning with -r.

This change is some really nice fit-and-finish for .NET 6. This behavior is the original intent of #19576.

This is the behavior with RC2.

rich@MacBook-Air-M1-2020 app % dotnet build --sc
Microsoft (R) Build Engine version 17.0.0-preview-21470-01+cb055d28f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
/usr/local/share/dotnet/sdk/6.0.100-rc.2.21473.35/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. [/Users/rich/app/app.csproj]

Build FAILED.

/usr/local/share/dotnet/sdk/6.0.100-rc.2.21473.35/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. [/Users/rich/app/app.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.03
rich@MacBook-Air-M1-2020 app % dotnet build --sc -r osx-arm64
Microsoft (R) Build Engine version 17.0.0-preview-21470-01+cb055d28f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /Users/rich/app/app.csproj (in 180 ms).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  app -> /Users/rich/app/bin/Debug/net6.0/osx-arm64/app.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:06.09

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions