Visual Studio 2019 Pro Doppler Token Help

Hey folks,

I am following along in the C# example using Visual Studio 2019 Pro, and am having some issues getting the DOPPLER_TOKEN variable pulled in.

What I have done:

  1. Set up my service token for my test project in the Doppler Dashboard
  2. Using the VS2019 Developer Powershell terminal, run $env:DOPPLER_TOKEN="…redacted…"
  3. Using the VS2019 Developer Powershell terminal, run Write-Host $env:DOPPLER_TOKEN, which shows the token is set.
  4. Added the following to my code

var builder = new ConfigurationBuilder()
var config = builder.Build();
var dopplerToken = config[“DOPPLER_TOKEN”];

When I step the code in this using VS2019, I can see the dopplerToken from config[“DOPPLER_TOKEN”] is null.

I’ve seen a ton of Doppler documentation and examples using VSCode, but our shop is using VS2019 Pro. I am sure I am missing something, and it’s probably stupid simple, but I am just not seeing it. If anyone can throw me a pointer, I’d really appreciate it.


So switching to using setx DOPPLER_TOKEN instead of using $env:DOPPLER_TOKEN appears to have resolved this, although that means the token has been added to the user’s environmental variables and are generally available if someone views all the environmental variables for the OS.