09 - .NET Core Console Application - Environment Variables

preview_player
Показать описание
Environment variables can help by allowing the application to determine what environment its in and what adjustments it needs to make based on configuration settings for that environment.

I'll do that by calling Environment.GetEnvironmentVariable method and passing in the name of the environment variable name.

One final setting we need to make is on the Properties of the Project file where I can add the Environment Variable along with the value.

I'll save everything and launch it…. You'll see that the settings it loaded are now from the Development Environment.

We'll select the correct profile for the Production Environment and launch it again.

In this case we still show the Development Environment Configuration Settings because I simply copied the file and forgot the modify its content. Let me make those adjustments real quick… Now you can see the changes that are loaded from the Production Configuration file.

In the next video I'll wrap things up and provide you with some additional resources that will help you in the case you find yourself having to write a .NET Core Console Application.

See you there!
Рекомендации по теме
Комментарии
Автор

For My Test.Json it does not pick up data from test.json file. Can you please help

kunaldedhia
Автор

Straight to the point... I like it
How do I mask my password to stop showing when I run my code?

Dunsin_official