I have been trying to access Azure's Blob Storage in dotnet core with the following line of code:
CloudStorageAccount account = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("<MyStorageName>_AzureStorageConnectionString")
);
Beforehand I have installed the required Azure SDK, and updated it to the dotnet core compatible version, then, since CloudConfigurationManager
was missing, I installed Microsoft.WindowsAzure.ConfigurationManager
, according to this answer. After having updated this package as well, Package restore failed with the following error message:
Package Microsoft.WindowsAzure.ConfigurationManager 3.2.1 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.WindowsAzure.ConfigurationManager 3.2.1 supports: net40 (.NETFramework,Version=v4.0)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Is there any option in order to get CloudConfigurationManager
working or do I need to find a workaround?
Package Microsoft.WindowsAzure.ConfigurationManager 3.2.1 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.WindowsAzure.ConfigurationManager 3.2.1 supports: net40 (.NETFramework,Version=v4.0)
In ASP.NET Core, the settings have been moved to appsettings.json. As far as I know, using CloudConfigurationManager
with .NETCoreApp is not supported by now.
For a workaround, you could follow the code below to implement your account
:
CloudStorageAccount account = new CloudStorageAccount(
new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
"<storage-accountname>",
"<storage-accountkey>"), true);
Additionally, you could refer to this related SO thread. Also, for a better understanding of Configuration in .NET Core, you could follow this tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With