Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 972
Manu Avatar asked Oct 03 '20 15:10

Manu


1 Answers

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.

like image 68
krishg Avatar answered Sep 28 '22 09:09

krishg