我试图将一个针对.NET Core 3.1的WPF应用程序(发布到文件夹)使用单文件发布,并定位于win-x86。该应用程序在Debug模式下可以成功发布,但在Release模式下失败。如果我取消选择“生成单个文件”,则发布就可以正常工作。我正在使用Visual Studio 2019(16.4.1和预览版16.5.1)。
当我进行发布时,会出现以下通用错误:
发布遇到了错误。发布遇到了错误。我们无法确定错误的原因。请检查输出日志以获取更多详细信息。
诊断日志已写入以下位置:"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.
我找到了这个问题,它暗示可能是由于Visual Studio超时引起的问题,尽管该问题与Azure有关。当我尝试使用ReadyToRun发布时,我还发现了这个Github问题也显示了类似的问题。
几周前,我们进行了成功的发布,并进行了最少量的更改。这可能是Visual Studio的问题吗?我意识到这可能是参考和NuGet软件包的问题,但我真的不知道从哪里开始解决这个问题... 发布没有提供任何有用信息来确定可能导致此问题的原因。有什么想法吗?
dotnet
命令行界面来发布它吗? - mm8