Viktor Morin
Viktor Morin

Reputation: 295

Azure Function - Could not load file or assembly

Im running an Azure Function .NET Standard 2.0 and get following error:

An exception of type 'System.IO.FileLoadException' occurred in Function.dll but was not handled in user code Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Reference

The assembly file exist in the bin/debug folder. Been reading some threads about this but without a solution (https://github.com/Azure/azure-functions-core-tools/issues/322#issuecomment-352233979), anyone know what to do?

I'm using code from another .NET Standard 2.0 project but all my projects have a reference to Microsoft.WindowsAzure.Storage 9.2.0.0 and that nuget package installed.

Thanks!

Upvotes: 1

Views: 1864

Answers (1)

Jerry Liu
Jerry Liu

Reputation: 17790

You can add reference below to downgrade your storage reference explicitly.

<PackageReference Include="WindowsAzure.Storage" Version="8.6.0" />

See this issue comment.

This restriction (like many of the other assembly version restrictions we had with other extensions) is a temporary issue and will be addressed in upcoming preview releases.

This issue has been fixed in latest host 2.0.11888, but built cli(tools to run functions) is not available yet.

Update

2.0.11888 has been available to VS users.

Upvotes: 1

Related Questions