HOWTO Take your Visual Studio browsing files under control

A couple of weeks ago, I noticed that one of the encrypted disks was going out of free space.

After some investigations, I found many folders containing huge VS2017 temp files:

<your solution folder>\.vs\<your solution name>\v15\ipch\AutoPCH

I fixed the problem by deleting them all.

The walkaround

I also found that this is a WAD (work as designed), but it can be a walkaround by updating VS2017 settings.

  • Select ‘Option‘ under ‘Tools‘ menu.
  • Look for ‘Text Editor\C/C++\Advanced‘ and then ‘Fallback location
  • set ‘Always Use Fallback…‘ and ‘Do not warn if…‘ to true

From what I observed, Intellisense doesn’t work very well with these settings.

To fix it, I found that you can set third entry (‘Fallback Location‘) to a dedicated Visual Studio trash folder of our choice (for example: ‘d:\_temp\_vs‘).

This has the benefits to move these files out from my encrypted disk, saving its free space, and improving VS performances if we choose an unencrypted disk for this trash folder.

The only drawback is that we have occasionally free this folder from the accumulated trash files.

Since they are stored in a dedicated project folder, we have to delete all present folders.

We can do that by writing down a small script like this one below:

@echo off
set group="<trash folder full pathname>\*"
for /d %%i in (%group%) do rd /s /q %%i
set group=

and run it manually or by the Task Scheduler… maybe each Monday during the lunchtime?

The command to be executed is:

%systemroot%\system32\cmd.exe

with the following parameters:

/c "<my batch file full filename>"