运行时标识符和 SelfContained

Mr.*_*oor 5 .net-core

我已经设置了RuntimeIdentifiersSelfContained如下

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
    <SelfContained>true</SelfContained>
    <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
  </PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

它失败了

不支持在不指定 RuntimeIdentifier 的情况下构建或发布独立的应用程序。请指定 RuntimeIdentifier 或将 SelfContained 设置为 false。瑞银服务

C:\Program Files\dotnet\sdk\3.1.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets 133

但根据医生的说法。property<RuntimeIdentifiers>元素允许您为项目指定以分号分隔的运行时标识符 (RID) 列表。RID 支持发布独立部署。

我错过了什么吗?或者文档有误?

更新:为了解决这个问题,我正在使用RuntimeIdentifier和 ,SelfContained如下所示。

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeIdentifier Condition=" '$(OS)' == 'Windows_NT' ">win-x64</RuntimeIdentifier>
    <RuntimeIdentifier Condition=" '$(OS)' == 'Unix' ">linux-x64</RuntimeIdentifier>
    <SelfContained>true</SelfContained>
    <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
  </PropertyGroup>
Run Code Online (Sandbox Code Playgroud)