Fork me on GitHub

Saturday, April 24, 2010

Visual Studio Tip: Reference files in Project Directory.

posted by Lars Hundebøl # 7:47 a.m.

Here is a nice little tip to reference files located in Visual Studio project directory, when running the project from within Visual Studio.

Use the following code:

string path = Path.Combine(Environment.CurrentDirectory, 
@"..\..\Test.xml");

Leave a comment

Your name

Your e-mail (will not be displayed)†

†Your e-mail will never be displayed and only used on the site to display your gravatar (if you got one), and as a means to potentially get back to you, if I have any feedback or questions regarding your comment.

all posts