简体   繁体   English

WebApi Soln具有多个项目,每个项目都有不同的WindowsAzure.Storage版本参考

[英]WebApi Soln with multiple projects each having different windowsAzure.Storage version reference

I have web api solution which has say two projects. 我有说两个项目的Web API解决方案。 Each of these project are refering to different versions of Microsoft.WindowsAzure.Storage assembly. 这些项目中的每一个都引用不同版本的Microsoft.WindowsAzure.Storage程序集。 And solution has another version of storage referenced. 解决方案引用了另一个版本的存储。

When I deploy the solution there is only one version of storage assembly (that referenced by soln) in the soln\\bin directory. 部署解决方案时,soln \\ bin目录中只有一个版本的存储程序集(由soln引用)。

Hence I am getting following error at runtime. 因此,我在运行时遇到以下错误。

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=8.1.1.0

Any help really appreciated. 任何帮助真的很感激。

As far as I know, we couldn't add different version of reference in same project. 据我所知,我们无法在同一项目中添加不同版本的引用。 So the only way to solve the different version of reference in same project is using the “Redirecting Assembly Versions”. 因此,解决同一项目中不同版本的引用的唯一方法是使用“重定向程序集版本”。 By using this way, you could make all different version of reference all redirect to the same version assembly. 通过使用这种方式,您可以使所有不同版本的引用全部重定向到同一版本程序集。

You could set it in your webconfig files. 您可以在webconfig文件中进行设置。

Like below: 如下所示:

<dependentAssembly>
        <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-8.1.1.0" newVersion="7.1.2.0" />
      </dependentAssembly>

This means make all Microsoft.WindowsAzure.Storage redirect to the 7.1.2.0(Which is installed in your web api project). 这意味着将所有Microsoft.WindowsAzure.Storage重定向到7.1.2.0(您的Web api项目中已安装)。

Besides, there are some differences between the different version of the azurestorage SDK. 此外,不同版本的azurestorage SDK之间也存在一些差异。 For example, one method have been removed in the new version. 例如,新版本中已删除一种方法。

So normally, we will use the same version of all the project, if we want to use them. 因此,通常,如果要使用它们,则将使用所有项目的相同版本。 I suggest you could check your codes and use the same version of the azure storage SDK in all three project. 我建议您可以检查您的代码,并在所有三个项目中使用相同版本的Azure Storage SDK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WindowsAzure.Storage,版本= 9.3.0.0-异常无法加载文件或程序集 - WindowsAzure.Storage, Version=9.3.0.0 - exception could not load file or assembly 我应该使用哪个版本的WindowsAzure.Storage? - Which version of WindowsAzure.Storage should I use? ExecuteQuery WindowsAzure.Storage 5.0.3没有扩展方法 - ExecuteQuery WindowsAzure.Storage 5.0.3 no extension method WindowsAzure.Storage没有使用.Net Core 1.0 - WindowsAzure.Storage on not working on .Net Core 1.0 WindowsAzure.Storage使用C#mono - WindowsAzure.Storage using C# mono 将WindowsAzure.Storage安装到针对Xamarin平台的PCL - Install WindowsAzure.Storage to PCL targeting Xamarin platforms 如何在Visual Studio 2013中安装WindowsAzure.Storage? - How do I install WindowsAzure.Storage in Visual Studio 2013? 共享访问从 windowsazure.storage 移动到 Azure.Storage.Files - Shared Access moving from windowsazure.storage to Azure.Storage.Files 从 WindowsAzure.Storage 迁移到 Azure.Storage 包时从 CloudStorageAccount 引用服务 - Referencing services from CloudStorageAccount when migrating from WindowsAzure.Storage to Azure.Storage packages 在 C# .NET Core 中使用 Azure TableStorage - Nuget Package WindowsAzure.Storage Alternative - Using Azure TableStorage in C# .NET Core - Nuget Package WindowsAzure.Storage Alternative
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM