linux - Win 10 -> VS 2019 -> .NET Core 3 WPF 应用程序 -> 发布到目录(对于 linux-x64 自包含) -> 发布失败
问题描述
我今天遇到的奇怪问题。
先决条件: 已安装:
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:
Then save and publish
预计会看到正在发布的应用程序。但是会弹出以下消息:
这是错误消息文件中提到的内容:
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.
解决方案
错误在构建输出窗口中:
没有可用于指定 RuntimeIdentifier 'linux-x64' 的 Microsoft.WindowsDesktop.App.WPF 运行时包
Linux 不支持 WPF,只有 Windows 支持。
推荐阅读
- java - @ConfigurationProperties 如何在 Spring 内部工作
- laravel - 动态创建 env 文件 laravel
- compilation - Pro*C 程序在 AIX 中正常运行,但在 RHEL 中无法正常运行
- python - 将 Enum 转换为 List 时跳过元素
- postman - 邮递员根据环境值发送请求
- allennlp - 使用“Predictor.from_path”加载“decomposable-attention-elmo”时出现问题
- r - R dplyr:按组过滤常用值
- sql - 选择满足动态表列出的要求的条目
- python - 为最短路径赋予与绘图中其他路径不同的颜色
- tableau-api - 在 Tableau 中创建包含 Excel 工作表列的下拉菜单