简体   繁体   中英

VS 2010 doesnt obey working directory with Console Applications

I am using Visual Studio C# 2010 Express and I created a Console Application.

I want this to run in a certain directory so I go to the project's properties and in the Debug-Tab i change the working directory.

But when i debug the application it is never run there, but always in the project directory/bin/Debug.

I also tried to change the output directory under the Build-Tab but it is also not obeyed. (The binary is not copied there but always in /projectdirectory/bin/Debug)

edit: I should not the following: in the same solution i have other projects (Class Libraries and Windows Forms Applications), which actually respect the settings for Working Directory and Output Path. It just seems to be Console Applications.

Working directory is what GetCurrentDirectory returns. Similar to cd in command prompt.

Working directory impacts what relative file path are relative too - ie opening "myFile.txt" (no file path) will search for file in "working directory" as base path if one specified in debug dialog or "output path" otherwise. You change working directory all the time while in command prompt: cd c:\\temp & findstr test *.txt" will run findstr` with working directory "c:\\temp" but will not change location of findstr.

Binary is placed in output path and not related what current working directory is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM