0

I am using visual studio 2008 and I have a few files that I want to reference when in #debug mode. How do I get the directory of the workspace so that I do not have to manually change it every time I am at a different computer?

For instance, when I'm at work, my workspace is in c:\work2, when I'm at home, it is in d:\work.

This isn't an issue on the live product but it is when I change computers or other uses load the project since the files are in different directories for each workspace.

thanks! Eroc

ErocM
  • 4,505
  • 24
  • 94
  • 161

2 Answers2

1

Add the test files (XML, spreadsheet, etc) as a 'Resource.' How to Add a Resource to your Project

Then, in your test files, you can use a relative address to access those files.

private const String = "./testFile1.xml";
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
  • I started with this and I was hoping to have a little more freedom but this was the route I went. Thanks for the input. – ErocM Oct 30 '12 at 18:58
0

You are able to have some pre-build command to change directory.

Anton
  • 9,682
  • 11
  • 38
  • 68