linux - Win 10 -> VS 2019 -> .NET Core 3 WPF 应用程序 -> 发布到目录(linux-x64 自包含) -> 发布失败

标签 linux wpf deployment .net-core-3.0 self-contained

我今天遇到的奇怪问题。

先决条件: 已安装:

VS2019
.NET Core 3.0

重现问题的步骤:

Create new "WPF App (.NET Core)"
To the MainWindow.xaml add single TextBlock:
    <TextBlock Text="WPF on Linux" TextWrapping="Wrap"/>
Create new Publish Profile like the following:

enter image description here

Then save and publish

预计会看到正在发布的应用程序。但会弹出以下消息:

enter image description here

错误信息文件中提到的内容如下:

2019-10-28 19:39:43
System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__202.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---

System.Exception: Publishing failed.

===================

问题是..我做错了什么和/或如何解决这个问题?

重要提示:

If Deployment Mode is set to "Framework Dependent", and the Target Runtime is "linux-x64" then the project is published into the directory with no issues.
If Deployment Mode is set to "Self-contained", but Target Runtime is "win-x64", then deployment works with no issues.

最佳答案

错误在构建输出窗口中:

There was no runtime pack for Microsoft.WindowsDesktop.App.WPF available for the specified RuntimeIdentifier 'linux-x64'

WPF 在 Linux 上不受支持,仅在 Windows 上受支持。

关于linux - Win 10 -> VS 2019 -> .NET Core 3 WPF 应用程序 -> 发布到目录(linux-x64 自包含) -> 发布失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58600641/

相关文章:

linux - gnuplot 中吞吐量的明显差异

wpf - 如何定位工具提示底部中心

css - 如何使用 Less CSS 将元素部署到 Heroku?

linux - 在 GNU/Linux 中使用 OpenSSL 部署应用程序

linux - Apache + SSL 错误 336027900

c - time_t 最终的 typedef 是什么?

linux - 在 amazonmanaged 区 block 链上将成员添加到现有的 hyperledger Fabric 1.2 网络

.net - 在 DataGrid 单元格中添加一个小的彩色矩形

c# - 对话框窗口 MVVM 方式

django - Gunicorn:停止服务器 'Worker failed to boot.'