首页 > 解决方案 > 无法加载文件或程序集 Microsoft.VisualStudio.DevOps.Contract

问题描述

我首次尝试在 Visual Studio 2019 中发布 .NET Core (3.1) Web 应用程序,但出现错误:

System.BadImageFormatException: Could not load file or assembly 'Microsoft.VisualStudio.DevOps.Contract, Version=15.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'Microsoft.VisualStudio.DevOps.Contract, Version=15.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.BadImageFormatException: Could not load file or assembly 'Microsoft.VisualStudio.DevOps.Contract, Version=15.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'Microsoft.VisualStudio.DevOps.Contract, Version=15.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.FetchContinuousDeliveryService()
   at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.InitializeContinuousDelivery()
   at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel..ctor(IThreadSwitcher threadSwitcher, IPublishServiceProvider serviceProvider, IVsHierarchy hierarchy, ITelemetryProvider telemetryProvider, IVsWrappersFactory vsWrappersFactory, IReadOnlyList`1 providers, IFeatureManager featureDetectionManager, IProfileController profileController, IDependenciesManagerProvider dependenciesManagerProvider)
   at Microsoft.Publish.Framework.Provider.DefaultPublishTabProvider.CreateViewAsync(IVsHierarchy project, IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken)
   at Microsoft.Publish.Framework.Provider.PublishProjectDesignerTabProvider.<CreateViewAsync>d__7.MoveNext()

之后在 VS 2019 中发布窗口似乎没有完全拉出。有什么想法吗?

标签: .net-corevisual-studio-2019

解决方案


我已经找到了这个问题的答案,我把它贴在这里。我重新安装了VS2019。我可能在原始安装期间错过了安装关键组件,例如 Azure,我不确定那个细节。


推荐阅读