它是“不支持的"在不指定 RuntimeIdentifier 的情况下构建或发布自包含应用程序 [英] It is "not supported" to build or publish a self-contained application without specifying a RuntimeIdentifier
问题描述
我正在尝试使用最新的 Visual Studio 2019 发布 DotNetCore 3.1 WPF 应用程序的 Msix 安装程序.应用程序构建并正确运行,但是当我尝试发布应用程序时出现此错误
Using the latest Visual Studio 2019 I am trying to publish a Msix installer for a DotNetCore 3.1 WPF application. The application builds and runs correctly, but when I try to publish the application I get this error
不支持在未指定 RuntimeIdentifier 的情况下构建或发布自包含应用程序.
我的 UI 项目 csproj 看起来像这样.
My UI projects csproj looks like this.
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
</PropertyGroup>
如何解决这个问题?
所以事实证明,只有在我尝试打包的 gui 项目中包含我自己托管的 asp.net 核心项目时才会出现问题.
So it turns out that the issue only occurs when I include my self hosted asp.net core project in the gui project that I am trying to package.
是什么导致了这个问题?是不是因为某种原因不支持打包那种项目?
What could be causing this issue? Is it just not supported to package that kind of project for some reason?
推荐答案
请删除你的PropertyGroup中的RuntimeIdentifier和SelfContained设置,然后输入dotnet publish -f netcoreapp3.1 -r win10-x64 --self-containedfalse 在 cmd.exe 中
Please delete the RuntimeIdentifier and SelfContained setting in your PropertyGroup, then input dotnet publish -f netcoreapp3.1 -r win10-x64 --self-contained false in the cmd.exe
这篇关于它是“不支持的"在不指定 RuntimeIdentifier 的情况下构建或发布自包含应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!