c# - Visual Studio cannot recognize a change in environment variable -
i using environment variable in program , setting variable value outside visual studio. when try below line of code, returns variable value if value set before opening current instance of vs. changes done later not have effect.
var variablevalue = environment.getenvironmentvariable("env_var");
to receive new value set, way out restart vs. looks vs caches these values on startup , doesn't consider new changes. however, question whether there way refresh current vs session such can read changed environment variable value & therefore need not go on restart again?
it possible per-machine environment variable. changes reflected in running process.
environment.getenvironmentvariable("env_var", environmentvariabletarget.machine)
if feasible use machine-wide variable depends on scenario, however.
Comments
Post a Comment