Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the working directory while debugging in Visual Studio?

I have a Windows Forms project in Visual Studio that reads configuration files from another 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 "<Executing assembly path>/Project1/connection.config".

When I however debug the Windows 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?

like image 713
Riri Avatar asked Jul 09 '09 10:07

Riri


People also ask

How do I set Debug path in Visual Studio?

In Solution Explorer, right-click the project and choose Properties. In the Configuration list, choose Debug or Release. In the side pane, choose Linker > Debugging, then select options for Generate Debug Info. In most C++ projects, the default value is Generate Debug Information (/DEBUG).


2 Answers

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

like image 101
Timbo Avatar answered Sep 19 '22 12:09

Timbo


I solved this problem by going to the project properties compile tab, and changing the build output path. Hopefully this will work for you.

I believe you will need to change that back to bin\ when you are ready to do a release build.

like image 28
Jason Avatar answered Sep 20 '22 12:09

Jason