33

What's the best practice for excluding/including the .vs folder for a VS 2015 solution in source control?

After an initial build/edit I only see a .suo file created so far at '[Root]/.vs/[SolutionName]/v14/.suo', so I'm assuming that's the replacement for the old '[SolutionName].suo' and should be excluded (generally) - but will other settings/etc be placed there in some scenarios that I might want to version?

From this uservoice, I'm guessing the answer is that it should be ignored, just wanted a confirm before I updated all my machine settings since I didn't see it in any local docs.

Gene
  • 1,587
  • 4
  • 18
  • 38

3 Answers3

38

You should not check .vs into source control.

It just contains temporary caches used by Roslyn.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • 3
    Agreed, seems like it. Have a reference so we can be sure by chance? Appreciate it sir! – Gene Jul 20 '15 at 21:58
  • Do you have any proof of that? I didn't check in that folder and now another developer's IDE is crashing because it can't find or edit a file from there. – Jonathan Allen Jul 31 '15 at 17:05
  • 2
    What error? Can you attach a debugger and check the exception? – SLaks Jul 31 '15 at 17:17
  • The .gitignore file automatically produced by the git support in Visual Studio 2015 has the entry: `# Visual Studio 2015 cache/options directory` `.vs/` So Microsoft ignores it. – Anders Zommarin Sep 11 '15 at 07:55
  • 1
    @AndersZommarin: That actually comes from GitHub. https://github.com/github/gitignore/blob/master/VisualStudio.gitignore#L25-L26 – SLaks Sep 11 '15 at 14:23
  • @SLaks: Does indeed look as Microsoft uses that file as the master for their `.gitignore` file. The one produced by VS2015 is slightly an old version. Good to know if updates are needed! – Anders Zommarin Sep 12 '15 at 11:47
  • We had a problem where 1 developer had things (Web) configured for his D:\ drive, and another developer had no D:\ drive. When the .vs\config\applicationhost.config file was then checked in, the developer without the D:\ drive couldn't even open the related projects. This thanks to having the ".vs" folder in source control after moving the solution from 1 tfs to another. We went in to TFS source control explorer and deleted it. Then when developers got latest we had them keep their local copy of applicationhost.config. The developer with the problems found a prior copy in prior changeset. – Greg Aug 05 '16 at 18:58
  • Anyway to prevent VS 2017 from creating this folder for simple C / C++ projects? – Royi Oct 11 '17 at 11:00
4

You should not check .vs into source control.

It just contains temporary caches used by Roslyn.

Yes, I agreed with SLaks - you can add .vs folder to ignore list - in fact you should do this on the beginning.

.vs contains more then only 'Roslyn cache' - but all stuff stored in this folder is 'working' or 'temporary'... It's means that is not required for storing solution/project - you can delete it when VS is shutdown and after that VS will recreated it when launching the solution - of course you lose your working configuration of the IDE, but no worries, it's not painful.

When you working with ASP.NET - you can find configuration of IISExpress inside .vs folder - and sometimes deleting this file can be very useful - like I said it will be recreated with 'fresh' settings when you lunch VS next time...

Community
  • 1
  • 1
Lukasz Mk
  • 7,000
  • 2
  • 27
  • 41
0

You can use .tfignore file rules for excluding some folders and files. It's practice very similar to .gitignore when you use Git, but for Team Foundation Version Control. Just create your file with your custom rules and start to use it.

ivamax9
  • 2,601
  • 24
  • 33