Home > Sample chapters > Programming > Visual Studio and .NET

Working with Documents in Microsoft Visual Studio

04.11 Understanding the File Open Location

MENU

Tools | Options | Environment | Documents

VERSIONS

2005, 2008, 2010

CODE

vstipEnv0035

Have you ever noticed that when you go to open a file in Visual Studio (Ctrl+O) it automatically uses the directory of the current active document?

httpatomoreillycomsourcemspimages899234.png

This is controlled by the Open File Using Directory Of Currently Active Document option. You can find this at Tools | Options | Environment | Documents.

httpatomoreillycomsourcemspimages899236.png

You can turn this feature off by clearing its check box, and Visual Studio then uses the DefaultFileOpenLocation from HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<version> in the registry instead.

Be aware that the DefaultFileOpenLocation changes every time you successfully open a file in the Open File dialog box. However, the update is not written to the registry until you close Visual Studio.