Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.0.0.0

SOF User picture SOF User · May 31, 2013 · Viewed 43.4k times · Source

We are using Azure SDK 1.8 and it working fine on local. we are using TFS hosted build controller to deploy on azure.

It was working fine before but sudden today we getting this error although we have no azure sdk dll version changed but online we get this error. Is this because of TFS build controller upgraded with new sdk? and strange thing this build is showing successful every time.

In TFS build service I found this strange stuff why it is referencing to v2.0 sdk. enter image description here

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Answer

Dragos Durlut picture Dragos Durlut · May 31, 2013

If everything else fails, and the correct DLL is deployed in the bin, try adding an assembly binding redirect in the web.config:

<dependentAssembly>
  <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" />
  <bindingRedirect oldVersion="2.0.0.0" newVersion="1.8.0.0" />
</dependentAssembly>

Change the binding version numbers as needed.