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

2024-03-11

我正在尝试使用发布单个文件,针对 win-x86 来发布针对 .NET Core 3.1 的 WPF 应用程序(到文件夹)。应用程序在“调试”下发布良好,但在“发布”下发布失败。如果我取消选择“生成单个文件”,则发布工作正常。我正在使用 Visual Studio 2019(16.4.1 和预览版 16.5.1)

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

发布遇到错误。发布遇到错误。我们 无法确定错误的原因。检查输出日志 更多细节。

诊断日志已写入以下位置: “C:\Users\用户名\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. 

I found 这个问题 https://stackoverflow.com/questions/59205875/error-when-trying-to-publish-an-azure-function-from-visual-studio这表明这可能是 Visual Studio 超时的问题,尽管该问题与 Azure 有关。我也发现了这个Github问题 https://github.com/dotnet/core-setup/issues/7746#issuecomment-564420814当我尝试使用 ReadyToRun 进行发布时,结果显示类似。

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


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

VS2019 16.3 和 dotnet Core 3.0 - 发布工作正常。

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

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

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

再次发表作品。

希望这可以帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

WPF .NET Core 3.1 应用程序发布单个文件(发布)失败 的相关文章

随机推荐