简体   繁体   中英

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

I have web api solution which has say two projects. Each of these project are refering to different versions of Microsoft.WindowsAzure.Storage assembly. 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.

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.

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).

Besides, there are some differences between the different version of the 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM