无法加载文件或程序集'Microsoft.WindowsAzure.ServiceRuntime,Version = 2.0.0.0

SOF*_*ser 19 azure tfsbuild azure-sdk-.net

我们正在使用Azure SDK 1.8,它在本地工作正常.我们正在使用TFS托管的构建控制器在Azure上进行部署.

它之前工作正常,但突然今天我们收到此错误,虽然我们没有更改azure sdk dll版本但在线我们得到此错误.这是因为TFS构建控制器升级了新的sdk吗?奇怪的是,这个版本每次都显示成功.

在TFS构建服务中,我发现了这个奇怪的东西,为什么它引用了v2.0 sdk. 在此输入图像描述

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)
Run Code Online (Sandbox Code Playgroud)

Dra*_*lut 20

如果其他一切都失败了,并且在bin中部署了正确的DLL,请尝试在web.config中添加程序集绑定重定向:

<dependentAssembly>
  <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" />
  <bindingRedirect oldVersion="2.0.0.0" newVersion="1.8.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

根据需要更改绑定版本号.


Luk*_*kos 7

这发生在我身上,因为我将引用从2.0更新到2.2但我仍然在我的web配置中引用了版本2.0 dll:

<system.diagnostics>
<trace autoflush="true">
  <listeners>
    <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
      <filter type="" />
    </add>
  </listeners>
</trace>
Run Code Online (Sandbox Code Playgroud)