Skip to main content

Use shared variables in HTTP files

Yesterday I explained how you can introduce environment specific variables when using .http files in Visual Studio. But now we need to repeat these variables for every environment even when they stay the same.

In this post I show how to avoid this by introducing the special $shared environment.

The $shared environment

Visual Studio 2022 version 17.12 introduced the $shared environment, which is perfect for variables that should be available across all environments:

You can now use these shared variables no matter which environment you have selected:

More information

Use .http files in Visual Studio 2022 | Microsoft Learn