0
votes

I want to publish my WPF application in Visual Studio 2019 (Version: 16.9.5).

I right-click on the project in the solution explorer, click on Publish and a new tab opens. The tab should show the settings for publishing, but is loading endlessly.

I tried with a blank/new console application, but I have the same problem.

Steps to publish: Tutorial: Publish a .NET console application using Visual Studio

EDIT: The Visual Studio Log regarding to the publisher:

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 ---
1
Did you try clearing the cache or repairing VS using the installer?Nasir
The issue occurred in VS19 v16.9.4, so I just updated to 16.9.5, but same issue. I also deleted cache, but sameChris
did you try to repair?Nasir
Yes, I tried. No effectChris
Did you try checking VS logs? Any extensions enabled? I also read that AntiVirus could cause VS to hang..not certain though as I've not experienced this.Nasir

1 Answers

0
votes

if you think it is a bug you can creating an issue here

or you You can try alternatively using cli publish-with-cli :

dotnet publish -c Release