BindingRedirect 在云服务中不被认可

her*_*dev 6 azure azure-cloud-services

我在初始化云服务时收到异常:

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

了解我已经4.3.0.0安装了版本,我app.config为我的工作人员添加了以下重定向:

<dependentAssembly>
  <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

当在本地模拟器中本地运行时,这可以解决问题。当这是通过打包cspackapp.configworker.dll.config包含在package.xml,两人都包括绑定重定向。还包括“Microsoft.WindowsAzure.Storage”,包括.dll.xml.

因此,在我看来,运行时所需的一切都已提供。

不幸的是,异常告诉我尚未应用重定向,它仍在寻找 version 2.1.0.0。我在这里做错了吗?

Gui*_*ume 3

添加一个以您的项目命名的文件,以便它与程序集的名称匹配。

{ProjectName}.dll.configCopy to Output Directory = AlwaysBuild action = None

该文件与您的 app.config 具有相同的语法。它应该包含您的程序集绑定。

由于某种原因,从 app.config 生成的文件未包含在部署包中。