开发者

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 开发者_如何学Pythonshows 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.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜