1
votes

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!

1
Can you remove that explicit reference? Functions SDK already references Microsoft.WindowsAzure.Storage of different version, so you get conflictsMikhail Shilkov
I tried to remove the refence, bot in this project and another project where the code was init, still same error..Viktor Morin
Hmm... delete bin-debug, rebuild?Mikhail Shilkov
Sorry no difference, reading the thread i posted indicate that it will require something more, but people stop posting in that thread in end of May so wonder if they solved it?Viktor Morin

1 Answers

1
votes

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.