Serg046
Serg046

Reputation: 1173

Set environment variable

I need some environment variables for my project. I placed it in the launchSettings.json as described here. I know it is VS-specific feature but it works fine with dotnet run cli command and it looks good for me. However it doesn't work for dotnet publish command. How should I set environment variables for production? I'd like to place it inside the project without using powershell, docker etc.

Upvotes: 0

Views: 319

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239440

The entire purpose of using environment variables is so that they are not part of your project. If you want them to be in your project, then just use appsettings.json. That's what it's for.

Upvotes: 1

Related Questions