WPF .NET Core 3.1 应用程序发布单个文件(发布)失败 [英] Publish Single File (Release) fails for WPF .NET Core 3.1 application

查看:58
本文介绍了WPF .NET Core 3.1 应用程序发布单个文件(发布)失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to publish a WPF Application (to a folder) targeting .NET Core 3.1, using Publish Single File, targeting win-x86. The application publishes fine for Debug, but fails for Release. If I deselect Produce Single File, the publish works fine. I'm using Visual Studio 2019 (16.4.1 and preview 16.5.1)

我在发布时遇到这个一般性错误:

I get this generic error when I publish:

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

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.

诊断日志已写入以下位置:"C:UsersusernameAppDataLocalTemp mpD176.tmp"

A diagnostic log has been written to the following location: "C:UsersusernameAppDataLocalTemp mpD176.tmp"

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

Plus a not-so-helpful log file:

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 相关.我还发现了这个 Github 问题,在我尝试时显示了类似的情况使用 ReadyToRun 发布.

I found this question that suggests that it might be an issue with Visual Studio timing out, though that issue is related to Azure. I also found this Github issue that showed a similar when I tried publishing with ReadyToRun.

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

We published with success a few weeks ago, with minimal changes. Could this be an issue with Visual Studio? I realize that this may be an issue with references and NuGet packages, but I don't really know where to start to get to the core of this issue... publishing doesn't provide any helpful information on what might be causing the issue. Any ideas?

推荐答案

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

I had the same problem with a WPF application :

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

VS2019 16.3 and dotnet Core 3.0 - publish worked fine.

已更新至 VS2019 16.4.1 和 dotnet Core 3.1 - 如所述发布失败.

Updated to VS2019 16.4.1 and dotnet Core 3.1 - publish failed as described.

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

Only difference is I am targeting X64.

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

After multiple attempts editing the publish FolderProfile (none of which fixed the problem), I deleted the FolderProfile completely and created a new one targeting a different folder.

再次发布作品.

希望这会有所帮助.

这篇关于WPF .NET Core 3.1 应用程序发布单个文件(发布)失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆