Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust service dependencies startup arguments in Visual Studio 2022

Question

Is it possible to set startup parameters or configure them in any way for service dependencies in Visual Studio 2022? Can I perhaps create my own?

Work around

Startup azurite manually with my preferred arguments before opening Visual Studio 2022.

Information

When opening a solution in Visual Studio 2022 Azurite is started when there is a service dependency on Storage Azurite emulator (local). When looking at the output I can see that some parameters are passed which I might want to override. Specifically the --location and --debug parameters. I am however unable to find where Visual Studio 2022 sets these parameters.

Output

Ensuring Azure Functions Core Tools are up to date. This may take a few minutes...
Azure Functions Core Tools are up to date.
AwesomeSecretProject.FunctionApp: c:\program files\microsoft visual studio\2022\professional\common7\ide\extensions\microsoft\Azure Storage Emulator\azurite.exe --location "C:\Users\SecretAgentBond\AppData\Local\Temp\Azurite" --debug "C:\Users\SecretAgentBond\AppData\Local\Temp\Azurite\debug.log" --skipApiVersionCheck
AwesomeSecretProject.FunctionApp: Azurite Blob service is starting at http://127.0.0.1:10000
AwesomeSecretProject.FunctionApp: Azurite Blob service is successfully listening at http://127.0.0.1:10000
AwesomeSecretProject.FunctionApp: Azurite Queue service is starting at http://127.0.0.1:10001
AwesomeSecretProject.FunctionApp: Azurite Queue service is successfully listening at http://127.0.0.1:10001
AwesomeSecretProject.FunctionApp: Azurite Table service is starting at http://127.0.0.1:10002
AwesomeSecretProject.FunctionApp: Azurite Table service is successfully listening at http://127.0.0.1:10002
like image 373
Rian Avatar asked Sep 12 '25 14:09

Rian


1 Answers

Facing the same issue and found that currently Visual Studio does not support setting configurations for Azurite (other than having Azurite use it's default settings) as per this page: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio

"For Azure Functions projects and ASP.NET projects, you can choose to configure the project to start Azurite automatically. This configuration is done during the project setup. While this project configuration starts Azurite automatically, Visual Studio doesn't expose detailed Azurite configuration options. To customize detailed Azurite configuration options, run the Azurite executable before launching Visual Studio."

This is just a pain to remember to do, so one alternative I found is to use Powershell as a Post-Build event that will start Azurite when running the project using F5 (note: this will start it even if you are just building the project).

powershell -Command "[System.Diagnostics.Process]::Start( '...path to azurite...\Microsoft\Azure Storage Emulator\azurite.exe', ' --blobPort 30000 --queuePort 30001 --tablePort 30002 ')"

The other option would be to add a "Dummy" project to the solution and set it to not build but have an option to start Azurite there in the project properties. Then instead of having a single startup project, change that to multiple startup projects and select the "Dummy" project in addition to the real one.

Hope VS team is working on something to expose the Azurite configuration options right within VS IDE.

like image 182
arvindram11 Avatar answered Sep 14 '25 07:09

arvindram11