docs icon indicating copy to clipboard operation
docs copied to clipboard

RuntimeIdentifier argument not working as expected when using dotnet publish on a solution

Open albpb2 opened this issue 1 week ago • 1 comments

Type of issue

Missing information

Description

According to this article, the -r argument in dotnet publish:

Publishes the application for a given runtime. For a list of Runtime Identifiers (RIDs), see the RID catalog. For more information, see .NET application publishing overview. If you use this option, use --self-contained or --no-self-contained also.

However, when running dotnet publish on a solution, the initial build is done ignoring the runtime identifier, so if there's any symbols or conditional behaviour depending on that runtime identifier, they won't be defined/won't work as expected (unless the runtime identifier is also defined in the csproj - while running dotnet publish on the specific project doesn't seem to require this). See https://learn.microsoft.com/es-es/answers/questions/5641840/runtimeidentifier-ignored-in-csproj-(-net-8).

Can the docs be updated to clarify this?

Page URL

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/tools/dotnet-publish.md

Document Version Independent Id

9439897e-dcb3-bc2e-5cae-35c1ca2e0681

Platform Id

a71f4ca7-7ced-6cf0-66e9-2e5eaac22732

Article author

@meaghanlewis

Metadata

  • ID: 211afdc7-c796-202d-239d-823f2a499dff
  • PlatformId: a71f4ca7-7ced-6cf0-66e9-2e5eaac22732
  • Service: dotnet-fundamentals

Related Issues

albpb2 avatar Dec 02 '25 12:12 albpb2