WPF OneClick 应用程序构建成功,但在 Visual Studio 2022 中发布失败

问题描述 投票:0回答:1

我多年来一直维护使用 OneClick 的桌面 WPF 应用程序。我目前正在使用 Visual Studio 2022。

最近,我更新了该应用程序,使其使用 .NET 8 和 EF Core。应用程序在 Visual Studio 中构建并运行,没有明显问题。

当我尝试“发布”OneClick 应用程序时,构建成功,但发布失败 --

8>CompilerServer: server - server processed compilation - 1b3eb992-ddfe-4b23-a907-e19f9bb6532a
Build: 7 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Build completed at 3:13 PM and took 51.644 seconds ==========
Publish: 0 succeeded, 1 failed, 0 skipped ==========
Publish completed at 3:13 PM and took 51.644 seconds ==========
Visual Studio accelerated 1 project(s), copying 12 file(s). See https://aka.ms/vs-build-acceleration.

除了一些 StyleCop 投诉之外,我在输出窗口中没有看到任何其他警告,但每次都会收到“发布失败”错误。

我注意到每次都会在事件日志中显示 URI 错误 -

活动中包含以下信息:

(devenv.exe, PID 15072, Thread 1) IdleProcessorManager.DoWork - Job threw:
Invalid URI: The format of the URI could not be determined. at
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at Microsoft.VisualStudio.TestTools.TestCaseManagement.SolutionIntegrationManager.IsRunConfig(String filename)
   at Microsoft.VisualStudio.TestTools.TestCaseManagement.SolutionIntegrationManager.<AddSolutionFilesRunConfigsToTmi>d__351.MoveNext()
   at Microsoft.VisualStudio.TestTools.TestCaseManagement.IdleProcessorManager.DoWork()

The message resource is present but the message was not found in the message table

我要发布的路径如下所示:\SERVER\File Server\AppName。这就是我多年来使用的相同路径。

生成的“日志”文件如下所示:

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

Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. 

嗯?有谁知道为什么会发生这种情况?或者我如何确定有问题的 URI 是什么?

我已尝试解决在构建输出中看到的警告,并且已解决除 StyleCop 警告之外的所有警告。这似乎没有帮助。

我尝试在 DEBUG 模式下构建时在 System.URI 类中放置断点,但是执行构建和发布工作的代码不会在断点处中断。

按照https://learn.microsoft.com/en-us/visualstudio/deployment/how-to-set-a-custom-log-file-location 中的建议,增加详细程度并重定向 ClickOnce 日志的输出-for-clickonce-deployment-errors?view=vs-2022 https://learn.microsoft.com/en-us/visualstudio/deployment/how-to-specify-verbose-log-files-for-clickonce -deployments?view=vs-2022 ,但我实际上在指定的目录中没有获得任何日志文件。

wpf visual-studio-2022 clickonce publish
1个回答
0
投票

我的发布问题的根本原因仍然是个谜,但是Hui Liu关于依赖项的建议有所帮助。

我“回滚”了许多最近的nuget包更新,发现这样做后应用程序发布正常。通过排除过程,我发现不更新 Microsoft.Extenstions.Logging.Console 就可以正常发布我的 OneClick 应用程序。我使用的是版本 7,而版本 8 似乎导致发布错误。

谢谢刘慧!

© www.soinside.com 2019 - 2024. All rights reserved.