.NET CORE System variables SET
In System variables
e.g1:
Variable name: ASPNETCORE_ENVIRONMENT
Variable value:Development
e.g2:
Variable name: xxxDBConnectionString
Variable value:Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=DBNAME;User ID=usre;Password=123
.net core code :
Add Reference:Microsoft.Extensions.Configuration
string dbConnection = Environment.GetEnvironmentVariable("xxxDBConnectionString");
Console.WriteLine(dbConnection);
string ev = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Console.WriteLine(ev);
Console.ReadKey();