views:

1488

answers:

2

I have a windows form project in Visual Studio that reads configuration files from an other project in the same solution. Once deployed this application will run from the root folder for the solution and the files will then be read from something like "/Project1/connection.config".

When I however debug the forms application and get the executing assembly path it will run from "bin/Debug" or "bin/Release" ergo the path to the configuration files is different.

Is there a way to tell Visual Studio either debug the application from a different path or just copy the application once compiled and debug/run it from the same path as it will be run from once it is deployed?

+4  A: 

In the project properties, open the debug tab. In there, you will find a textbox to change the working directory.

Timbo
For some reason this still loads the executing assembly from bin/Debug
Riri
+1  A: 

Set a post build event on your project to move the config file into the debug build directory.

Right click on the project that will require the config from a different project and select properties, then click on the build events tab and add a post build event something like this:

Copy configFilePath $(TargetPath)

Russell Troywest