c# - WPF .NET Core 3.1 应用程序发布单个文件(发布)失败

标签 c# wpf visual-studio .net-core .net-core-3.1

我正在尝试使用针对 win-x86 的发布单个文件发布面向 .NET Core 3.1 的 WPF 应用程序(到文件夹)。该应用程序可以很好地发布调试,但发布失败。如果我取消选择 Produce Single File,则发布工作正常。我使用的是 Visual Studio 2019(16.4.1 和预览版 16.5.1)

我在发布时收到此一般错误:

Publish has encountered an error. Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.

A diagnostic log has been written to the following location: "C:\Users\username\AppData\Local\Temp\tmpD176.tmp"



加上一个不太有用的日志文件:

System.AggregateException: One or more errors occurred. ---> System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. 
   --- 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__156.MoveNext()
---> (Inner Exception #0) System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---

System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. 

我找到了 this question这表明这可能是 Visual Studio 超时的问题,尽管该问题与 Azure 相关。我也发现了这个 Github issue当我尝试使用 ReadyToRun 发布时,显示出类似的情况。

我们在几周前成功发布,改动很小。这可能是 Visual Studio 的问题吗?我意识到这可能是引用和 NuGet 包的问题,​​但我真的不知道从哪里开始进入这个问题的核心......发布没有提供任何可能导致问题的有用信息.有任何想法吗?

最佳答案

我在 WPF 应用程序中遇到了同样的问题:

VS2019 16.3 和 dotnet Core 3.0 - 发布运行良好。

更新到 VS2019 16.4.1 和 dotnet Core 3.1 - 如所述发布失败。

唯一的区别是我的目标是 X64。

在多次尝试编辑发布 FolderProfile(均未解决问题)后,我完全删除了 FolderProfile 并创建了一个针对不同文件夹的新文件夹。

再次发布作品。

希望这可以帮助。

关于c# - WPF .NET Core 3.1 应用程序发布单个文件(发布)失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59357765/

相关文章:

c++ - 确定 C++ 中包含符号的来源

c# - IL,发出默认构造函数调用

c# - C# 上不允许出现默认参数说明符错误

wpf - LINQ to Entities 异常(ElementAtOrDefault 和 CompareObjectEqual)

c# - Refit Net core AddRefitClient 读取响应头

c++ - 奇怪的调试器问题?

c# - 获取动态加载程序集的位置

c# - 为了向后兼容,我需要编写什么样的 setter?

c# - WPF 应用程序是否有等效于 $.connection.hub.start().done() Javascript 方法?

visual-studio - 使用 Visual Studio 的 QNetworkAccessManager 问题