Visual Studio: How to Ensure Huge Amounts of .ipch Files Are Moved Out of the Project Directory
Are you using Visual Studio for development? If so, you might have noticed that Visual Studio generates huge amounts of .ipch files. In my case, it was about 50 GB in a short time.
".ipch" files are part of Visual Studio, Microsoft's Integrated Development Environment (IDE). These files are associated with the "IntelliSense" feature in Visual Studio. Here are some key points about ".ipch" files:
- IntelliSense Caching: ".ipch" files are used to store cache data for the IntelliSense feature in Visual Studio. IntelliSense is a code completion feature that assists developers by providing suggestions for code elements, such as variable names, methods, functions, etc.
- Enhanced Productivity: By storing data in ".ipch" files, IntelliSense helps to accelerate the code development process by reducing the need to remember exact details about code libraries and APIs.
- Temporary Storage: These files are temporary and are automatically generated by Visual Studio during coding. They play a crucial role in making the coding process more efficient, but they are not necessary for the actual program code and do not need to be version-controlled or shared.
- File Location: Usually, you find ".ipch" files in an "ipch" folder inside the project's folder structure. They can occupy significant disk space, especially in larger projects.
- Security and Sharing: Since ".ipch" files are specific to a developer's local machine and Visual Studio installation, they do not contain sensitive information and are generally not intended for sharing or distribution.
In summary, ".ipch" files are part of Visual Studio's streamlining of the coding process through IntelliSense, and they help to improve the overall development experience by providing quick access to relevant code documentation and suggestions.
I prefer my directory structure to be as "clean" as possible, meaning that the directory structure contains only code and code-related files. IPCH files greatly disturb this concept!
Fortunately, there is a way to move these files out of the project directory. Through settings in Visual Studio’s Tools > Options > Text Editor > C/C++ > Advanced > Browsing Database Fallback, you can force these files there instead. I have a D:Work directory that already receives most other build files from my projects, and there I create the following directory:
D:WorkMicrosoft Visual StudioIntelliSense FallBack
In Visual Studio's settings, I change the following:
Always Use Fallback Location: True
Do Not Warn If Fallback Location Used: True
Fallback Location: D:WorkMicrosoft Visual StudioIntelliSense FallBack