I am creating an extension for visual studio, and one of the requested functions is that it can change the environment variable to one of several parameters, which will then be inherited by the application, which is developed after its debugging.
I tried the following
Environment.SetEnvironmentVariable("foo", "bar", EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("foo", "bar", EnvironmentVariableTarget.Machine);
but while this is being saved, the variable does not seem to pass it to the program after I clicked the run button.
I am looking for other ways to do this to try, and I don't mind if they are hacks.
Edit: for clarification, this process should be transparent to a debugged (arbitrary) program. It should also be a software solution.
source share