【发布时间】:2021-05-18 03:23:57
【问题描述】:
我想在 Visual Studio 2019(版本:16.9.5)中发布我的 WPF 应用程序。
我在解决方案资源管理器中右键单击该项目,单击Publish 并打开一个新选项卡。该选项卡应显示发布设置,但会无休止地加载。
我尝试使用空白/新控制台应用程序,但我遇到了同样的问题。
发布步骤:Tutorial: Publish a .NET console application using Visual Studio
编辑:关于发布者的 Visual Studio 日志:
Microsoft.ServiceHub.Framework.ServiceActivationFailedException: Activating the "Microsoft.Publish.Framework.PublishProfilesService (1.0)" service failed. ---> System.ComponentModel.Composition.ImportCardinalityMismatchException: No exports were found that match the constraint: 
	ContractName	Microsoft.Publish.Framework.Nexus.IPublishProfilesService
	RequiredTypeIdentity	Microsoft.Publish.Framework.Nexus.IPublishProfilesService
 at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
 at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality)
 at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValueCore[T](String contractName, ImportCardinality cardinality)
 at Microsoft.Publish.Framework.Nexus.PublishProfilesService.<CreateAsync>d__0.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.VisualStudio.PublishPackage.<<InitializeAsync>b__7_1>d.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 System.Threading.Tasks.ValueTask`1.get_Result()
 at Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.ProfferedServiceFactory.<InvokeFactoryAsync>d__32.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.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.ProfferedServiceFactory.<GetProxyAsync>d__28`1.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 System.Threading.Tasks.ValueTask`1.get_Result()
 at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
 at Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.<GetProxyAsync>d__19`1.MoveNext()
 --- End of inner exception stack trace ---
【问题讨论】:
-
您是否尝试使用安装程序清除缓存或修复 VS?
-
这个问题发生在VS19 v16.9.4,所以我刚刚更新到16.9.5,但同样的问题。我也删除了缓存,但还是一样
-
您尝试修复了吗?
-
是的,我试过了。没有影响
-
你试过检查 VS 日志吗?是否启用了任何扩展?我还读到 AntiVirus 可能会导致 VS 挂起。虽然我没有经历过,但不确定。
标签: c# visual-studio visual-studio-2019 publishing