Reputation: 1136
I'd like to create an environmental variable, or macro to be shared between my WPF application and installer projects.
I know how to do this for a C++ project, since I can create a new property page, create a new user macro and share this with other projects within the solution.
Can I do the same thing in C#/WPF projects?
Upvotes: 1
Views: 1195
Reputation: 304
Use System.Environment class.
Method for that is: System.Environment.GetEnvironmentVariable ()
and System.Environment.SetEnvironmentVariable()
Also note the optional third parameter:
System.Environment.SetEnvironmentVariable (variable, value, EnvironmentVariableTarget) Possible values are: Machine, Process and User
Hope this helps!
Upvotes: 1