发布ClickOnce导致Publish遇到错误。无法保存个人资料

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

在使用 ClickOnce 部署时的许多不同项目上,当使用现有配置文件将新版本的 WinForms 应用程序发布到文件共享时,我遇到了麻烦:


Publish has encountered an error.
The profile could not be saved.

A diagnostic log has been written to the following location:
"C:\Users\{mywindowsusername}\AppData\Local\Temp\2\tmp5504.tmp"

其内容为:

28/09/2023 11:43:23
Microsoft.WebTools.Shared.Exceptions.WebToolsException: The profile could not be saved. ---> System.InvalidOperationException: An equivalent project (a project with the same global properties and tools version) is already present in the project collection, with the path "C:\data\tfs\project_number\project_name-Development\Solution\SpiSt.WinApp\Properties\PublishProfiles\myprofile.pubxml". To load an equivalent into this project collection, unload this project first.
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadedProjectCollection.AddProject(Project project)
   at Microsoft.Build.Evaluation.ProjectCollection.OnAfterRenameLoadedProject(String oldFullPathIfAny, Project project)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, Boolean interactive)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, Boolean interactive)
   at Microsoft.Publish.Framework.NewFx.Persistence.MsBuildFilePersister.UpdateAsync(String filePath, IReadOnlyDictionary`2 profileData, CancellationToken cancellationToken)
   at Microsoft.Publish.Framework.NewFx.Persistence.MsBuildFilePersister.StoreAsync(String filePath, IReadOnlyDictionary`2 profileData, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.Publish.Framework.NewFx.Persistence.MsBuildFilePersister.StoreAsync(String filePath, IReadOnlyDictionary`2 profileData, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.ClickOnce.Publish.Util.<StorePubXmlAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ClickOnce.Publish.ProfileVisual.<PostPublishStepAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.Nexus.PublishProfilesServiceImpl.ServerProjectProfilesManager.<RunPublishTaskAsync>d__73.MoveNext()

我正在使用 Visual Studio 2022、.net6.0-windows、WinForms 应用程序。

有什么想法可以解决这个问题吗?

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

Visual Studio 在创建配置文件时似乎使用登录帐户。

我用于登录 Visual Studio 的登录凭据不正确/无效。当我单击菜单栏最右侧的帐户图标时,Visual Studio 提示我重新输入凭据。

我从我的 Microsoft 帐户中注销了 Visual Studio,然后我就能够成功发布我的项目。

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