Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working Directory in Visual Studio C# file

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.

like image 728
user358591 Avatar asked Sep 09 '10 14:09

user358591


People also ask

What is the working directory in Visual Studio?

Working Directory is the location which Specifies the working directory of the program being debugged. It is the default place in which a program is looking up it's files. Normally the working directory is the directory the application is launched from \bin\debug by default.

What is working directory in C?

The chdir command is a system function (system call) which is used to change the current working directory. On some systems, this command is used as an alias for the shell command cd. chdir changes the current working directory of the calling process to the directory specified in path.

How do I find the working directory?

While in Windows Explorer, the current working directory is shown at the top of the Explorer window in a file address bar. For example, if you were in the System32 folder, you would see "C:\Windows\System32" or "Computer > C:>Windows\System32" depending on your version of Windows.

How do I change the current working directory code in Visual Studio?

To open the Settings editor, use the following VS Code menu command: On Windows/Linux - File > Preferences > Settings. On macOS - Code > Preferences > Settings.


1 Answers

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.

like image 157
Brian R. Bondy Avatar answered Sep 17 '22 18:09

Brian R. Bondy