Controlling where Visual Studio puts files

I actually like Visual Studio. More specifically, I like Microsoft’s C++ compiler as being both speedy and producing pretty good code on x86 and x64. So, it’s more accurate to say that I tolerate Visual Studio overall. It’s frustrating how they can take good ideas (msbuild) and screw them up (msbuild).

Visual Studio by default scatters artifacts everywhere. I like a tidier build folder. Here are the non-build-output artifacts I know about (as opposed to your source files like .cpp, or as opposed to build artifacts like .obj, .lib and .exe).

  • *.aps
  • *.filters
  • *.idb
  • ipch/
  • *.sdf
  • *.suo
  • *.user

Why should these be kept separate from your source? Because you hand source to other people, but you would never hand any of these artifacts to others.


This is present in Visual Studio 2003 and up. Microsoft calls this “Solution User Options”, or alternatively “solution options file”; it is per-user, and contains environment state like window positions, breakpoints and so forth.

Tough luck; barring writing some ninja file system filter, your .suo files go right next to the .sln file. It’s pretty ugly.


This is present in Visual Studio 2010 and up. This is the IntelliSense database.

First off, if the IntelliSense database is disabled, neither the .sdf file (which is the IntelliSense database) nor ipch folders (which contain IntelliSense’s precompiled information) are created.This is draconian, but maybe you see no need for IntelliSense because you use some other tool like Visual Assist. This isn’t quite the same as fully disabling Intellisense, but almost – the only feature that still works if you do this is the #include auto-complete.

To disable the IntelliSense database, go to Tools -> Options -> Text Editor -> C/C++ -> Advanced, and change Disable Database to True. This will have the side-effect of removing ipch folders, too. I’m not saying you want to do this.

If you want to just move where the .sdf file goes, then follow the directions for relocating the ipch folders below – the .sdf database and the ipch folders are created in the same location.


This is present in Visual Studio 2003 and up. This contains precompiled information that IntelliSense generates and uses.

Starting with Visual Studio 2010, Intellisense creates an ipch folders to store precompiled headers. Of course, it can’t use the compiler’s precompiled headers, it has to make its own (that was mild sarcasm, sorry). By default, this goes next to the corresponding solution file (*.sln).

Unfortunately, there’s no solution-level control for anything – a solution file is really just a container to reference project files, and have a modicum of coordination in regards to build dependencies. But, at least for Intellisense, there is a global preference for where to store ipch files; you can put all your ipch folders in your temp folder, for example. The folder names inside the ipch folder are already disambiguated with the name of the solution and a hash of the full path to the solution to avoid conflicts.

Visual Studio 2010

Go to Tools > Options > Text Editor > C/C++ > Advanced ->Fallback Location (Tools menu, pick the Options menu item to bring up the Options dialog, expand the Text Editor section, expand the C/C++ subsection, click on the Advanced subsection, scroll down to the sub-group labelled Fallback Location).

Set Always Use Fallback Location to True. If you do nothing else, this will put your ipch folders in %TEMP% (which at least in Windows 7 defaults to C:\users\AppData\Local\Temp\ if your boot is C: and you haven’t played with any default settings). If you want more fine-grained control, put a path into Fallback Location – but, honestly, %TEMP% is a good place for these. Observation notes that it puts its files inside a VC++ folder in your temp director.

You’ll also want to set Do Not Warn If Fallback Location Used to True. If you leave it set to False, you’ll get a ominous-looking dialog when Visual Studio starts up and can’t find the database file; users who press Cancel will inadvertently disable IntelliSense for that session of Visual Studio. And you’ll get this each time you start up, unless you click the checkbox in the dialog (which says “don’t warn me again”). There are probably uses for this warning, but I can live without it.


This is present in Visual Studio 2012 and up.

This file contains per-user settings. Specifically, it seems to exist to contain the debug settings like “Working Directory” and “Command Arguments”, and was previously persisted in the .suo file (is this correct?). Generally, you don’t check this file into source control. This file is created by a wizard, but it’s set to a default value, so if you just delete the file, there should be no harm. If a user changes any debug settings, this file will get created.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>