question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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 https://github.com/dotnet/sdk/pull/22314.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
nagilsoncommented, Sep 13, 2022

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

1reaction
richlandercommented, Jun 15, 2022

I wrote a mini-spec on FDD + (implicit) RID-specific apps at https://github.com/dotnet/sdk/issues/26031

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found