1gn1ter
1gn1ter

Reputation: 1444

Using WindowsAzure.Storage 8.5 with CloudBlockBlob and BlobAttribute in Azure Functions

While using WindowsAzure.Storage 7.2.1 one function is fine, but other functions depend on 8.5 and they fail. If I'm using WindowsAzure.Storage 8.5 to upload blob file it throws an error:

Can't bind Blob to type Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob

How would you resolve such conflict?

Here is my code to upload a blob:

public static void Run(other params, IBinder binder)
{
        string fileUrl = $"test-blob/{Guid.NewGuid().ToString()}";                   
        var blob = binder.Bind<Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob>(new BlobAttribute(fileUrl));
        blob.UploadText($"test text file: {fileUrl}");
}

Upvotes: 2

Views: 250

Answers (1)

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35134

You can't use any version of Microsoft.WindowsAzure.Storage higher than the one used by Functions runtime (7.2.1 for 1.x versions of Functions). Remove that reference from your project.

For further information see Binding redirect support.

Upvotes: 3

Related Questions