Vignesh Chandramohan
Vignesh Chandramohan

Reputation: 1306

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

Upvotes: 3

Views: 991

Answers (1)

LanderV
LanderV

Reputation: 1177

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.

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

Upvotes: 0

Related Questions