Search code examples
gitvisual-studioversion-controlvisual-studio-2017

Which files created by Visual Studio 2017 should I ignore in version control?


Visual Studio 2017 (I've also seen this referred to as Visual Studio 15 2017, confusingly enough) introduces "Open Folder" support with CMake integration. In this case, it creates a few new files in my working copy. Here is what I noticed:

.vs/ProjectSettings.json
.vs/slnx.sqlite
.vs/source/v15/Browse.VC.db
CMakeSettings.json

It seems obvious that CMakeSettings.json goes into version control. But what about the contents of the .vs/ directory? If it helps to provide examples, I'm using Git for version control, so I'd need a reliable set of patterns to put into my .gitignore file.

Possible duplicate

It has been suggested this post is a duplicate of this question, however I don't think that is correct. In my case, VS 2017 adds several new files to my working copy that were not used in previous versions of Visual Studio.


Solution

  • https://www.gitignore.io/api/visualstudio is considerably the definitive starting point for a project in Visual Studio. Do read through it, as there are a couple sections to uncomment depending on how your project may be structured.

    If you create a new project in VS2017 and add it to source control, or add an existing project to source control, VS will actually add a copy of this file to your repo as well. It seems though that the Open Folder functionality doesn't quite have that level of git integration exposed yet (there was no Add to Source Control that I could find).