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

1

13

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
  • VSFeedbackVSRTCLogs
  • 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.

Unstrung answered 4/3, 2023 at 21:18 Comment(4)
Knowing that current storage is mainly SSD, with every deletion counting down silently to death, I vote for developers caring a bit more about this 'kinda policy "fill the temp folder, space is no more an issue". Worrying about space and efficiency should be an always recommended attitude, as @wnscripter is.Euell
My approach - if its in temp, then its a temp file and can be deleted. Any app putting stuff in there should know it'll be wiped and will recreate it as needed. I also change my temp folder to be on a different drive, some people even put them in a ramdrive.Xenos
@Xenos Despite the temp folder containing the temporary files, and even "temp" being an acronym as "temporary", it doesn't always mean deleting files from it can be done without impacting software. A couple years ago (when I still didn't have VS installed), I deleted the entire Temp folder altogether, leaving just the empty Temp folder. This impacted games I had installed and prevented them from launching. Some other games required a re-download. So I can only guess whether deleting those files will cause problems with Visual Studio or not.Unstrung
VS is a terrible litterbug, has been for a long time. MSFT knows about it but don't care enough to fix it. I too clean up from time to time, deleting them is fine. Once every 6 months is a reasonable schedule.Onepiece
C
7

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.

Cutlor answered 3/12, 2023 at 10:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.