8

My work development PC is resource-constrained with only 28GB for the main system disk. There is a 1TB external HDD and some data and applications have been moved there.

However, I'm still regularly running into Windows 10 "Low Disk Space" warnings which are triggered when free space drops below ~1GB. While actively working, this happens several times a week. You have to waste time deleting temporary files, emptying the recycle bin, etc.

There are naturally many causes, but the primary culprit in my case and the focus of this question is Visual Studio 2019. Whenever I perform even a simple build (C++ DLL and EXE projects), Visual Studio 2019 creates dozens of files all over the disk. After several days, the number can be in the thousands and GBs in size. Very few of these files appear to be essential - you can generally safely delete them while the project is still open in Visual Studio!

Examples include:

  • %LOCALAPPDATA%\Microsoft\VisualStudio\SettingsLogs*
  • %LOCALAPPDATA%\Temp_CL_*
  • %LOCALAPPDATA%\Temp\dd_BackgroundDownload*.log
  • %LOCALAPPDATA%\Temp\dd_updateconfiguration*.log
  • %LOCALAPPDATA%\Temp\servicehub\logs*
  • %LOCALAPPDATA%\Temp\VSFeedbackIntelliCodeLogs*
  • %LOCALAPPDATA%\Temp\VSRemoteControl*
  • .vs (eg. IntelliSense database)

and many more.

What steps can I take to:

  • reduce (or eliminate) all but essential temporary/cache files
  • move temporary/cache file generation to the external disk
  • request Visual Studio to clean up after itself when the IDE is closed

Don't bother with unhelpful comments like "get a larger disk". Even with a large local HDD it would be sensible to reduce the number and size of files hitting disk. Given enough time, any disk will eventually run into this problem.

2
  • 1
    Not sure this is the answer I never use BATCH FILES but that said it looks like you have more experience than me so have at it stackoverflow.com/questions/10716803/…
    – Vector
    Commented Jul 27, 2020 at 19:26
  • Update based on the comment from @Vector: I've now got batch files which run on Windows startup to clear out thousands of Visual Studio files (mostly in the locations mentioned in the question). At this time, I know of no way to get Visual Studio to reduce these file creations, or to clean up after itself.
    – AlainD
    Commented Jul 14, 2021 at 9:39

1 Answer 1

9

I have been suffering the same problem for more than a year. There are many the occasions when I access my temp folder and I have seen hundreds and hundreds of directories and files with random alphanumeric naming pattern of 12 total length (########.###). And I did not know where it came from ...until I started investigating yesterday. Your question helped me to identify more temp files.

In the end you get used to it and stop giving it importance, but it is really uncomfortable and dirty since the number of files keeps growing and growing, and growing in size as well, and so on, until the next cleaning of the system.

For that reason I have developed a free extension for Visual Studio 2019.

You can download it from here:

https://marketplace.visualstudio.com/items?itemName=elektroHacker.VsAutomaticTempFileCleaner

And here is the repository for the source-code:

https://github.com/ElektroStudios/VsAutomaticTempFileCleaner

The extension will handle the Visual Studio's application exit to start deleting temp files. It only deletes temp files related to Visual Studio (so it does not empty the temp folder neither delete non-related files). Unfortunately some temp files are still in use / open by VS when closing the IDE, so they cannot be deleted (It could be done by delaying the deletion procedure executing a external process after VS process has been totally terminated, but it's too much work), but those files are a very little minority.

In any case, we can now say goodbye to the thousands of Visual Studio files that remain in the temporary folder pending for clean.

I hope this helps you and everyone concerned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.