Azure-functions-core-tools: System.Private.CoreLib: Could not load file or assembly 'Microsoft.WindowsAzure.Storage

Created on 20 Mar 2018  路  16Comments  路  Source: Azure/azure-functions-core-tools

I just updated VS Professional from v15.6.2 to v15.6.3 earlier today. After the update, I get a runtime error when running my Azure function. Prior to the update, it was running just fine.

System.Private.CoreLib: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Here's a screenshot

2018-03-19_17h57_55

My Azure function's dependency hierarchy looks like this

2018-03-19_18h17_14

I tried restarting VS, restarting my pc. None worked.

Most helpful comment

@ahmelsayed: Sadly no, still have the same error with the latest version

System.Private.CoreLib: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Using

Visual Studio 2017 15.7.1
Azure Functions and Web Jobs Tools 15.0.40502.0

All 16 comments

Same error while migrating our v1 apps to v2, except I'm on VS 15.6.4, Functions SDK 1.0.12, and webjobs.* 3.0.0-beta5 across the board. According to object browser, the storage 9.1.0 DLL is in the netstandard 1.3 cache, and I see it was copied into the project's bin folder.

image

image

Edit: Noticed the "listening" entry in the OPs console output so I guess it isn't trigger-specific -- my Function only contains a BlobTrigger.

Based on this gentleman's experience https://github.com/Azure/azure-functions-core-tools/issues/322#issuecomment-352233979 it sounds as if the CLI (or more likely, some dependency) might be tied to an incompatible version?

Running the latest func beta doesn't help, same error (tools 220.0.0-beta.0, runtime 2.0.11651.0).

If I'm looking at this correctly, it looks like this reference to version 8.6.0 is probably the culprit since the CLI csproj depends on that assembly.

As @MV10 pointed out there already is 8.6.0 of WindowsAzure.Storage included in your project. The easiest way to get rid of the issue is to use that version for now if your code is not depending on a newer version.

I have the same issue only for "Microsoft.Extensions.Configuration". I am referencing 2.0.1 in my DLL, which is the exact same version used by the Functions SDK (1.0.13). My unit tests all pass with flying colors, so this seems to be an issue in the Functions Tools. All mentions of Microsoft.Extensions.Configuration in the deps.json files point to 2.0.1.

My DLL points to the config DLL at "C:Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.configuration\2.0.1".

The config DLL is also present in the bin folder, having (Windows) "File version 2.0.1.18051".

Any suggestions as how to proceed?

I run my functions app locally using "func host start" in the output folder.

My error message: System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

This should be fixed in the latest v2 release

@ahmelsayed: Sadly no, still have the same error with the latest version

System.Private.CoreLib: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Using

Visual Studio 2017 15.7.1
Azure Functions and Web Jobs Tools 15.0.40502.0

I have the same error as @wboevink - i have tried a few alternatives. Some guidance would be greatly appreciated. A gist of the generated dependencies is here

I am using the latest VS Mac alpha - details here

* Update *
Not sure why i hadn't tried sooner but running fun in the bin folder works fine. It also works fine when deployed to Azure. So, just that error when using the VS launcher. I can resolve it as follows locally:

cd bin/Debug/netstandard2.0 && func host start

I just created this issue
https://github.com/Azure/Azure-Functions/issues/821

And it is related to this. I am running 2.0.1-beta.27 and the hard reference to 8.06 is still there. running func host start does not resolve the issue.

func host start does not solve the issue, it may seem to work depending on the Azure Function dependencies because it starts runtime version on 1.x by default. You can observe that in the console log:
Starting Host (HostId=e505cc11c08147b69cd4f6a95d861b6e, Version=1.0.10826.0, ProcessId=25444, Debug=False, Attempt=0)

[6/7/2018 3:26:00 PM] System.Private.CoreLib: Exception while executing function
: TimerTriggerCSharp. Patient.CredentialStore.AzureFunctions: Could not load fil
e or assembly 'Microsoft.WindowsAzure.Storage, Version=9.2.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exce
ption from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or
assembly 'Microsoft.WindowsAzure.Storage, Version=9.2.0.0, Culture=neutral, Publ
icKeyToken=31bf3856ad364e35'.

Am also facing the same problem i have tried with downgrading webjobs beta , stable versions still couldn't solve the issues to integrate azure table storage with the azure functions .. ;( ;(

Seems like the solution is to downgrade WindowsAzure.Storage nuget to version 8.6.0 as mentioned here:
https://github.com/Azure/azure-functions-core-tools/issues/322

This worked for me.

@mithunshanbhag yah the webjobs beta 3.X not works with the table storage version > 8.6

A little late to the party, but I just had this issue with VS 15.7 and Azure Function Cli 2.7 (I think, I forgot to verify before updating). After updating to VS 15.8.6 and Azure Function Cli 2.8.1 the problem appears to be resolved.

I was having the same issue on a blob triggered v2 Azure function. Upgrading to the latest, Azure Function Cli version 2.10.1 and VS Professional 2017 15.8.7 worked fine for me. @delroyh thanks for your post here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nzthiago picture nzthiago  路  3Comments

AssassinTee picture AssassinTee  路  3Comments

buragc picture buragc  路  6Comments

brandonh-msft picture brandonh-msft  路  4Comments

MattHoneycutt picture MattHoneycutt  路  4Comments