Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 698
winscripter Avatar asked Dec 18 '25 09:12

winscripter


2 Answers

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.

like image 82
stefan.seeland Avatar answered Dec 21 '25 01:12

stefan.seeland


I found out in my VS 17.12 has the same behavior and it turned out that auto update cause these files (pre downloading all necessary packages and msi). I once got 7GB of files in temp folder and 5GB created by VS (mainly packages in Microsoft.VisualStudio / ASP / SQL namespaces, so it's all pretty sure about VS itself), and after I start updating the VS, the download size is exactly 5GB and the update is quick, and after it finishes, large files in temp folder are gone.

like image 27
Ge Rong Avatar answered Dec 21 '25 01:12

Ge Rong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!