user1400716
user1400716

Reputation: 1136

wpf User Macros & Environment Variables

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

Answers (1)

presarioruby
presarioruby

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

Related Questions