azure-storagevisual-studio-2022

How to use Azurite with Visual Studio 2022?


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.


Solution

  • 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.

    enter image description here

    enter image description here

    enter image description here

    enter image description here

    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.

    enter image description here

    Packages to Install from NuGet Manager

    enter image description here

    <?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>
    

    enter image description here

    Refer this MSDoc for more details.