How to replace Microsoft.WindowsAzure.Storage with Microsoft.Azure.Storage.Blob

10,717

First of all, one little correction. Microsoft.Azure.Storage.Blob has been replaced by a newer SDK Azure.Storage.Blobs and it is recommended you upgrade to the new one (v12 SDSK) instead. It was a move by Microsoft to update all their SDKs to follow unified API standard. You can read more about that here

Into what problems could I run, when I keep on using Microsoft.WindowsAzure.Storage 8.0.1?

WindowsAzure.Storage is deprecated and the last version 9.3.3 was release on Nov 2018. Though it still works and not yet out of support, but it is recommended to move to the newer Azure.Storage.Blobs package to leverage better performance, update, feature release and continued support in future.

Are there any recommended ways to replace Microsoft.WindowsAzure.Storage 8.0.1 with Microsoft.Azure.Storage.Blob?

As mentioned in the beginning, correct package is Azure.Storage.Blobs actually. There is a good article on the update guide and tips here

When I replace Microsoft.WindowsAzure.Storage 8.0.1 with Microsoft.Azure.Storage.Blob, will I have to re-write my code for dealing with uploading/downloading blob?

Upgrading to the older package Microsoft.Azure.Storage.Blob will need very little change in code. But the latest SDK Azure.Storage.Blobs will need you some changes. As described here, there several changes in namespace, classes, methods.

|  Package  |    Old Microsoft.Azure.Storage.Blob   |   v12   Azure.Storage.Blobs   |
|:---------:|:-------------------------------------:|:-----------------------------:|
| Namespace | Microsoft.Azure.Storage.Blob.Protocol | Azure.Storage.Blobs.Models    |
| Namespace | Microsoft.Azure.Storage.Blob          | Azure.Storage.Blobs           |
| Namespace | Microsoft.Azure.Storage               | Azure                         |
| Class     | CloudBlobClient                       | BlobServiceClient             |
| Class     | CloudBlobContainer                    | BlobContainerClient           |
| Class     | CloudBlockBlob                        | BlobClient or BlockBlobClient |
| Class     | StorageException                      | RequestFailedException        |
| Class     | BlobErrorCodeStrings                  | BlobErrorCode                 |

UPDATE: Since you are using .net framework 4.5.2, Azure.Storage.Blobs is not supported for you. You would have to go with Microsoft.Azure.Storage.Blob.

Share:
10,717
Manu
Author by

Manu

Updated on June 11, 2022

Comments

  • Manu
    Manu almost 2 years

    In my asp.net mvc application I am using Microsoft.WindowsAzure.Storage 8.0.1 for uploading/downloading blob to/from an azure cloud container. Now NuGet Package Manager informed me that Microsoft.WindowsAzure.Storage is deprecated and that I should use Microsoft.Azure.Storage.Blob.

    Questions:

    1. Into what problems could I run, when I keep on using Microsoft.WindowsAzure.Storage 8.0.1?
    2. Are there any recommended ways to replace Microsoft.WindowsAzure.Storage 8.0.1 with Microsoft.Azure.Storage.Blob?
    3. When I replace Microsoft.WindowsAzure.Storage 8.0.1 with Microsoft.Azure.Storage.Blob, will I have to re-write my code for dealing with uploading/downloading blob?

    Any help and advice will be appreciated.

  • Manu
    Manu over 3 years
    My application is targetting .NET Framework 4.5.2 but Azure.Storage.Blobs needs at least 4.6.1. No chance to use Azure.Storage.Blobs with 4.5.2?
  • krishg
    krishg over 3 years
    Unfortunately no. In that case, I would suggest to go with the older V11 SDK i.e. Microsoft.Azure.Storage.Blob which supports 4.5.2
  • AyCe
    AyCe over 3 years
    What is the replacement for this? docs.microsoft.com/en-us/dotnet/api/…
  • krishg
    krishg over 3 years
    You don't really need CloudBlobDirectory for anything real. Anything which you could do with it's methods are practically possible from BlobContainerClient and BlobServiceClient in V12 SDK.