I have a project that requires Azure Storage. Previously, I have been using the Microsoft Azure Storage Emulator - v5.10, which can easily be run from the Search bar.
How can Azurite be setup to be used in a project in Visual Studio 2022?
There is no Connected Service
appearing in my Solution Explorer
. And when I right-click a project and select Add
, the Connection Service
it is deactivated.
I have a multi-project ASP .NET MVC solution, mostly running .NET Framework 4.8.
In Visual Studio Installer
=> Visual Studio
=> Modify
=> Individual components
, I have unchecked the .NET Framework 4.8 SDK
=> Remove
=> Modify
.
You can see that the components related to Azure resource have been removed.
Connected Services
, I can see the option to Manage Connected Services
but the Connected Services window is not opened.Azure development
/ .NET Framework 4.8 SDK
(under Individual components) and modify VS, the components related to Azure resources will be added.Modify VS with above changes.
Now Iam able to see and add Azurite from Connected services
.
Is there a preferred way to integrate it with Visual Studio or any recommended best practices for this?
Yes, this is the most easy and preferred way to add Azure resources.
If you still face issues, you can even integrate Azurite manually (but includes manual steps to follow which is not easy to configure).
The below screenshot is from Connected Services, try to install the specified packages manually.
Packages to Install from NuGet Manager
Right click on the Solution Explorer
=> Manage User Secrets
, secrets.xml will be created.
Add the below settings in secrets.xml
.
<?xml version="1.0" encoding="utf-8"?>
<root>
<secrets ver="1.0">
<secret name="Azurite" value="UseDevelopmentStorage=true" />
<secret name="Azurite:blob" value="UseDevelopmentStorage=true" />
<secret name="Azurite:queue" value="UseDevelopmentStorage=true" />
</secrets>
</root>
serviceDependencies
prefix has to be added which contains the Azurite ConnectionID.Refer this MSDoc for more details.