Setting Environment Variables in Visual Studio Launch Settings Using Host Environment Variable

cw 1 Reputation point
2021-05-28T23:18:35.243+00:00

We have a need to do something like the following with environment variables in our launchSettings.json file:

"SOME_ENV": "${env.SOME_HOST_ENV}/someVal"

When I get the environment variable at runtime, I get SOME_ENV = "${env.SOME_HOST_ENV}/someVal". Is this something that is possible with Visual Studio 2019 in a launchSettings.json file?

Developer technologies Visual Studio Debugging
Developer technologies Visual Studio Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2021-05-31T03:42:19.487+00:00

    Hello @cw ,

    Welcome to Microsoft Q&A forum.

    I think this is not possible.

    Not sure what you need, but maybe as a workaround, is it possible for you to get the host environment variable first in launchSettings.json file and then combine them in the codes to get some/other variables?

    Best Regards,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.