diditexas
diditexas

Reputation: 121

how to define an environment variable for a c# project

I have to modify a C# project to add new features using VS 2012 and first I am trying to build it and run it before modifying anything to make sure I have everything before starting.

When I run the app, it stops because it tries to find an environment variable and can't figure out how to create that variable without modifying the code.

Here is the piece of code where it looks for the variable:

string searchPath = Environment.GetEnvironmentVariable("OWN_VARIABLE_PATH");

I have tried to add user and system environment variables but without success.

I would really appreciate any advise.

Upvotes: 2

Views: 437

Answers (1)

James Smithy Cleave
James Smithy Cleave

Reputation: 131

Have you made sure that the variable is set in your Environment Settings?

See this link:

http://www.beansoftware.com/NET-Tutorials/Environment-Variables.aspx

Upvotes: 1

Related Questions