在Azure函数中使用WindowsAzure.Storage 8.5与CloudBlockBlob和BlobAttribute

时间:2018-04-27 15:26:17

标签: azure azure-storage-blobs azure-functions

使用WindowsAzure.Storage 7.2.1时,一个功能很好,但其他功能依赖于8.5而且它们失败了。 如果我使用WindowsAzure.Storage 8.5上传blob文件,则会抛出错误:

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

您如何解决此类冲突?

以下是我上传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}");
}

1 个答案:

答案 0 :(得分:3)

您不能使用高于函数运行时使用的Microsoft.WindowsAzure.Storage的任何版本(7.2.1用于1.x版本的函数)。从项目中删除该引用。

有关详细信息,请参阅Binding redirect support

相关问题