在不指定运行时标识符的情况下构建或发布自包含应用程序是"not supported"的



使用最新的Visual Studio 2019,我正在尝试为DotNetCore 3.1 WPF应用程序发布Msix安装程序。应用程序构建并运行正常,但是当我尝试发布应用程序时,出现此错误

It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier.

我的 UI 项目 csproj 看起来像这样。

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
</PropertyGroup>

如何解决此问题?

编辑:所以事实证明,只有当我在我尝试打包的 gui 项目中包含我的自托管 asp.net 核心项目时,才会出现问题。

可能导致此问题的原因是什么?只是由于某种原因不支持打包此类项目吗?

請刪除 PropertyGroup 中的 RuntimeIdentifier 和 SelfContain(英语:RuntimeIdentifier and SelfContain( 設置,然後在 cmd 中輸入dotnet publish -f netcoreapp3.1 -r win10-x64 --self-contain-false.exe

最新更新