Search code examples
visual-studiotemporary-filestemp

Visual Studio 2022 adds an overwhelming amount of folders into %TEMP%: Is it safe to delete them?


I am new (I'd say) to Visual Studio. I installed it about ~a month ago. Although, while using Visual Studio, I see a huge problem. As I open %TEMP% folder (user temp directory), I see a ton of folders with absolutely random names. Some of them are empty, some consist of a 0-byte JSON file with random name also. Just look at this mess. I am absolutely sorry if you cannot read this language, but it's not important, the only important thing is to look at folder names. These are all generated by Visual Studio! VS TempDirs

Now, I know these do not occupy disk space at all. But I absolutely don't like looking at this mess. I can use the Disk Cleanup tool that's integrated into Windows. However, there are 2 things to mention:

  • Disk Cleanup only deletes 0-byte JSON files, not the directories.
  • There are some huge directories also created by Visual Studio, which Disk Cleanup actually would delete. But I think it is unsafe to delete them.

For example, take a look at this directory that's in the TEMP directory as well, also with a completely random name. This one has a size of 1.7GB. VS 1.7GB Directory

Basically, I think deleting this folder would cause problems with Visual Studio. It is also one of the folders Disk Cleanup can delete.

So my question is: Would deleting the following folders cause problems with Visual Studio 2022?:

  • VS
  • VSTempFiles
  • VSTelem
  • VSTelem.Out
  • VSFeedbackIntelliCodeLogs
  • VSFeedbackPerfWatsonData
  • MSBuildTempuser (where user is the name of the current user; it could be different)
  • NuGetScratch
  • The 1.7GB directory with a random name described above with an image
  • Tons of 0-byte directories with random names

Not important: I know that I may be asking too much here.


Solution

  • It's safe to delete files created by Visual Studio in %temp%. Beside that you could opt out of telemetry to reduce the amount of junk created by vs. Use the UI or a scripted version to opt out of telemetry.

    Known unknowns about the purpose of these directories and files

    The available public documentation does not sufficiently clarify the behavior in question. Corresponding requests to Microsoft lack the necessary level of detail. Despite the dissatisfaction among developers, it is practice to not give the created files importance and address it using some tooling.