Tim Coulter
Tim Coulter

Reputation: 8927

WindowsAzure.Storage SDK missing APIs in .NET Standard

I am converting a .NET Framework 4.7.1 class library to .NET Standard 2.0.

The library consumes a number of Nuget packages, all of which are available for both .NET Framework and .NET Standard and these packages include the WindowsAzure.Storage SDK.

The original .NET Framework class library compiles and runs correctly, but the .NET Standard library fails to compile, due to missing APIs (and some different method signatures) on the WindowsAzure.Storage SDK.

For example, CloudBlockBlob has a DeleteIfExists method in .NET Framework but not in .NET Standard.

The API documentation lists this method (and all the others that are broken in .NET Standard) but doesn't appear to mention any version differences between target frameworks. Did I miss something relevant here?

Is it normal that some .NET Standard Nuget packages have gaps in their APIs?

Is there a solution or a workaround for this (apart from re-writing the code that consumes these APIs)?

Thanks, in advance.

Upvotes: 0

Views: 497

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29985

As per Peter Bons mentioned, In the nuget package WindowsAzure.Storage, there are only task based methods, so DeleteIfExistsAsync for .net core / .net standard.

Please use the new nuget package for azure storage. For blob storage, you can install Microsoft.Azure.Storage.Blob, version 9.4.0 or above, which does support sync / async methods.

The change log is here:

enter image description here

And here is a simple test with .net standard project with Microsoft.Azure.Storage.Blob, version 9.4.0 or above installed. Both sync / async methods are there.

enter image description here

Upvotes: 3

Related Questions