简体   繁体   中英

Microsoft.WindowsAzure.Storage.dll version mismatch error in azure functions

I am using a dll (MyApp.dll) which references azure storage dll version 7.2.1 through a nuget. I have added a project.json file to my azure function with "WindowsAzure.Storage": "7.2.1" . I have also uploaded Microsoft.WindowsAzure.Storage to bin\\ directory. My run.csx file just has "new MyApp.Run(req)".

I get following error about missing dll, what else can I change in my azure function to resolve this error? I can use MyApp.dll fine locally.

The type initializer for '' threw an exception. Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=8.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).

Did you reference WindowsAzure.Storage yourself in project.json? You shouldn't, because that one is already referenced for you by the environment. You should use #r to reference this one:

#r "Microsoft.WindowsAzure.Storage"
using Microsoft.WindowsAzure.Storage.Blob;

This is simply set in your function itself.

docs.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp#referencing-external-assemblies

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