31

I have a 3gb .vs folder in my C++ project.

I am wondering if it is safe to delete the .vs folder.

If not what can i do to decrease the volume.

Thanks in advance.

  • 4
    Experiment by renaming the folder instead. You ought to see that upon re-opening the project you lost the customized view of the project, IntelliSense goes catatonic for a while as it re-parses the files and you'll get the 3gb back. There is an option to put the big IS database in a dedicated directory, makes it easy to clean up. – Hans Passant Apr 01 '18 at 11:09
  • A VS developer have explained the purpose of the `.vs` folder ([link](https://developercommunity.visualstudio.com/content/problem/82249/vs-folder.html)): The `.vs` folder is required by VS to store opened documents, breakpoints, and other information about state of your solution. Combined with the other answers below, you can roughly assess the risk of deleting the folder. These `.vs` folders take up a lot of space on my disks, for this reason I made a tool that can easily delete all `.vs` folders from the disks, and I hope it will help some people. https://github.com/SpriteOvO/VsCacheCleaner – Sprite Dec 12 '20 at 03:48
  • @HansPassant If I rename the .vs folder for an experiment and everything seems fine, then is it okay to delete the .vs folder? Also, if renaming it makes my solution/project weird, is it okay to rename it back to .vs again? Lastly, where can I find the option to put the IS database in a dedicated directory? (well... I don't know what exactly 'IS database' is though :) – starriet Apr 12 '23 at 04:05

7 Answers7

38

The .vs folder is generated by Visual Studio and is readily re-created. Sometimes removing .vs is necessary to get a project building again, for example after a Visual Studio update, or opening the solution from a portable drive on a different computer.

However, be aware that you will lose some user state related to the solution:

  • Selected build configuration
  • Local debug settings, like startup project(s)

You will NOT lose:

  • Solution/project structure
  • Build configuration definitions
  • Project dependencies
  • Third-party extension settings etc.
Jonathan Lidbeck
  • 1,555
  • 1
  • 14
  • 15
9

I delete the .vs folder to conserve space. Delete it OUTSIDE of Visual Studio. Then open Visual Studio and REBUILD the program. the .vs folder is recreated, and is usually smaller.

pollaris
  • 1,281
  • 17
  • 20
  • Note that if you have renamed one project, it is quite usefull to remove .vs folder to remove any trace of the old name of the project (traces present in binary files in the .vs folder or in .bsc, .exe, .ilk or .pdb). – kingsjester Dec 08 '22 at 14:35
6

[It Works] For me .vs folder takes almost 5GB space and a big problem when taking backup or comparing folders. This is due to visual studio "Intellisense" feature doing some covert logging to augment our sense.

This solution works for me.

Visual Studio | Tools | Options | Text Editor | C/C++ | Under "Intellisense" category set "Disable Automatic Precompiled Header" to true.

enter image description here

userom
  • 403
  • 5
  • 8
  • Confirm this helps with VS2019 Community Edition, though you still end up with giant `Browse.VC.db` files. This is disappointingly wasteful of VS2019... – AlainD Mar 10 '20 at 13:05
1

Chiming in with my own experience.

If you are working on something that is very much location dependent (for example, OpenGL which has lot of hard coded linking and library including), then, the answer is.

No. You should not delete.

If it is not like the OpenGL situation, then,

Yes, you can delete it. visual studio will simply recreate that folder for you.

also, if I remember correctly, .vs is part of the standard .gitignore file for visual studio projects. that also hints that you can happily delete things (except for stuff like OpenGL)

Jay
  • 2,648
  • 4
  • 29
  • 58
  • What does it mean by _"location dependent"_ and _"hard coded linking"_? Is it okay to delete the .vs file in the typical situation? I didn't get the idea of what the _"OpenGL situation"_ is. – starriet Apr 12 '23 at 03:51
  • location independent means, like where, your libraries come from an online service. for example, in node js projects, we don't have to worry about the 'location' of the many packages we use. they will get downloaded from the internet. With OpenGL and C ++, that may not always work. so, I called that situation 'location dependent'. – Jay Apr 13 '23 at 06:00
  • Then, we should _not_ delete the .vs folder, right? That's quite different from what other people are saying. – starriet Apr 13 '23 at 23:32
  • If your situation is C++, Open GL and stuff like that, then, yes, "you should not delete it". But, when you change your computer, or you code on multiple computers, then, obviously, to avoid conflicts, you should delete it. The whole thing is complex, it's trial and error if you ask me – Jay Apr 15 '23 at 07:12
0

I have deleted this folder from a number of different solutions without issues and have found that it can sometimes get you out of trouble when all else fails!

See this question that I asked a year ago for an example of where deleting this folder fixed the problem of duplicate tests that were showing up for me in Visual Stidio Visual Studio 2019 showing duplicate tests in Test Explorer

Mike
  • 827
  • 11
  • 27
0

Save your files first! I lost all my most recent changes. On the other hand, VS had gone strange with totally inappropriate error messages. These were all cleared.

tjl
  • 131
  • 1
  • 5
-3

Find a folder called AutoPCH and delete all the files inside. :)