Azure functions failing when upgrading to 1.0.8

0

Using the latest version of VS 2017 I

  • Create a new azure functions project.
  • Add a timer trigger function
  • Upgrade to latest (1.0.8) azure functions nuget package
  • Add a reference to azure storage for creating table client
  • run the project, and it just failes on load.

A ScriptHost error has occurred [06.03.2018 20.46.05] Exception while executing function: Function1. FunctionApp2: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=8.6.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=8.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Sample code:

    [FunctionName("Function1")]
    public static void Run([TimerTrigger("0 */5 * * * *", RunOnStartup = true)]TimerInfo myTimer, TraceWriter log)
    {
        log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
        var storageAccount = CloudStorageAccount.Parse("[someConnectionString]");
        var tbc = storageAccount.CreateCloudBlobClient();
    }

How can I fix this?

azure
azure-functions
asked on Stack Overflow Mar 6, 2018 by Oddleif • edited Mar 26, 2018 by Janusz Nowak

1 Answer

1

Could not load file or assembly 'Microsoft.WindowsAzure.Storage

According to your error message , it seems that you have missed the Microsoft.WindowsAzure.Storage assembly or the package version conflict. You could check whether you have used the same package of different versions. Check the compatibility of dependencies of Microsoft.NET.Sdk.Functions 1.0.8 . Or try to uninstall then reinstall the Microsoft.NET.Sdk.Functions package.

I follow your steps to install Microsoft.NET.Sdk.Functions 1.0.8 from Manage Nuget Packages in Visual Studio. Then I run the TimeTrigger directly. Everything works fine. I could see the Microsoft.WindowsAzure.Storage package in dependencies.

enter image description here

And you could check the project.assets file in your Azure function folder.

enter image description here

The running result:

enter image description here

Besides, this article have some similar issues, you could refer to.

answered on Stack Overflow Mar 7, 2018 by Janley Zhang • edited Mar 8, 2018 by Janley Zhang

User contributions licensed under CC BY-SA 3.0