How to overcome “Could not load type 'Microsof

2019-09-06 03:39发布

问题:

I'm getting the same error message as in this question: Could not load type 'Microsoft.Cct.Services.Sqm.IWatSqmService' Unfortunately, I cannot upgrade to Azure SDK 2.9, as the top answer there suggests.

Specifically, I get this error in a message box whenever I try to package my Azure Cloud Service project:

What's interesting is that I can start the same project in the emulator, which I would assume involves packaging it.

Things I've tried:

  1. Ensuring that I only have version 2.8.2 of the emulator installed (I may have had 2.9 installed initially)
  2. Reinstalling version 2.8.2 of the SDK
  3. Manually copying the Windows Azure Tools from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0 to the v14.0 equivalent.
  4. Ensuring that C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.8 exists
  5. Reinstalling Visual Studio (so you know I'm desperate!)

And I've no idea what to try next. I can't work out which DLL is supposed to hold the Microsoft.VisualStudio.WindowsAzure.Services assembly, I can't find any references in any config files, and all the Google hits seem to point back to the SO question linked above.

What's going on? And how can I fix it?


In case I'm being an idiot, here's all the Azure-related things I've got installed:

Also (just in case it's relevant) I'm on Windows 7 SP1.


Update 17/01/16

Following some advice from the excellent Rest Azured Slack channel, I've tried using ProcMon and Fusion Log to diagnose this (spoiler: without success)

ProcMon filtered to that assembly returns nothing:

Fusion log (set to log everything) yields lots of entries like this:

* Assembly Binder Log Entry (17/01/2017 @ 11:52:02) *

The operation was successful. Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Microsoft.VisualStudio.WindowsAzure.Services, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = devenv.exe Calling assembly : Microsoft.VisualStudio.WindowsAzure, Version=2.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. === WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). WRN: No matching native image found. LOG: IL assembly loaded from C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\Microsoft.VisualStudio.WindowsAzure.Services.dll.

When I explore the DLL mentioned, I can find Microsoft.Cct.Services.Sqm, but it doesn't contain a type IWatSqlService:

This feels like it's the crux of the issue, but I've no idea what to do next. Presumably I'd need to replace the DLL with a version that does define IWatSqlService, but I'm not sure where I'd get one. Or, for that matter, why it would even be necessary.

Next stop is probably a full wipe of the machine.

回答1:

I've had the same problem, and solved it by not using the Web Platform Installer.

Download all parts (Microsoft Azure SDK for .NET - 2.8.2) from the Microsoft site: https://www.microsoft.com/en-us/download/details.aspx?id=50041 and follow the instructions how to install them.



回答2:

For anyone else with this problem. I ended up resolving this by nuking it from orbit. Fresh install of Windows, reinstall VS and the SDK.



回答3:

Confusingly, you can also see this error when you add a new

<setting name="TODO" />

element to your *.csdef file but either:

  1. forget to add the corresponding <setting name="TODO" value="TODO" /> element to every *.cscfg file, or

  2. accidentally add a duplicate <setting name="TODO" value="TODO" /> element to any of the *.cscfg files.