Question

What exactly is Working Directory in the properties of Visual Studio C# project.

I have see a project where I right click and go to Properties and then I go to Debug tab, it shows me Working Directory where Author of the code has specified folder in local machine. I want to know what does that working directory means and what kinds of file will it store in that directory.

Thank you in advance.

Was it helpful?

Solution

The working directory of a project (and any Windows program in general) is the default place in which a program is looking up it's files. For example: My program has working directory C:\dir and tries to open test.txt, it would look in C:\dir\test.txt.

So every opened file will be opened relative to the working folder.

OTHER TIPS

Every process has a current Working Directory which is where all relative paths will be formed from. If not specified, this directory is the directory in which the active application started.

You can check which directory is set by calling:

System.IO.Directory.GetCurrentDirectory();

As mentioned above in a comment by @0xA3 this setting has no effect to your deployed product, it is is only for debugging.

I think it will store nothing there, unless you add/write code in your application which explicitly creates files, either explicitly in the application's working directory, or implicitly specifying only a filename without specifying a directory at all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top