Using the latest version of VS 2017 I
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?
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.
And you could check the project.assets file in your Azure function folder.
The running result:
Besides, this article have some similar issues, you could refer to.
User contributions licensed under CC BY-SA 3.0