Visual Studio 2015 creates a new folder called ".vs". What is the purpose of it and should I add it to source control?
-
1Possible duplicate of .vs\config\applicationhost.config in source control– Michael FreidgeimCommented Mar 21, 2016 at 0:55
-
2@MichaelFreidgeim: Not sure, the other question asks about a specific file and this is about the whole folder. But it happens that some of the broader answers fit both.– SoftwareFactorCommented Mar 21, 2016 at 17:36
3 Answers
No, you should not add it to source control. The purpose of this folder is to move machine- and user-specific files to a central location. The explanation on the Visual Studio User Voice issue explains it well:
So far, we have moved the .SUO file and the VB/C# compiler IntelliSense database files to the new location. All new project specific, machine local files will be added to the new location too. We plan on taking this even further in future releases and are investigating how to improve the directory structure of build output and other existing files that can clutter the source tree.
These are all files that you would never check in, since they are generated from a build or contain machine-specific information.
-
26That's kind of a broad stroke to say don't checkin the whole folder. If your website requires specific IIS Express configs (like using a hostname for cookies to work), checking in the
applicationhost.config
helps other devs in setting up their environment, otherwise each one has to do it on their own and they probably find it out the hard way.– MrchiefCommented Oct 12, 2015 at 18:59 -
3@Mrchief I'm not an IIS developer, but I believe this answer address that. Commented Oct 12, 2015 at 19:45
-
2That answer is really not a solution, more of an workaround (which the answer itself alludes to). What I was trying to say was that a binary answer may not be enough for everyone. Depending on your setup, you may have to exclude the folder but then add an exception for the
applicationhost.config
file or something towards that effect.– MrchiefCommented Oct 12, 2015 at 19:48 -
4@Mrchief: Actually that's no workaround, this is the best solution. I don't think you should ever checkin the .vs folder, it is not intended to be.– D.R.Commented Jan 11, 2016 at 8:00
-
6As the cited answer of lugberk states: "there is no way to tell ASP.NET 5 projects to look for this today". Because of that, I don't see any other option to share those IIS Express configuration settings between ASP.NET 5 projects than that of checking in the applicationhost.config file under .vs. Or do you see any other / better solution?– GustinCommented May 23, 2016 at 12:00
Github provides alot of .gitignore templates. In their template for visual studio they have ignored the .vs folder. Snippet from the template on github.
# Visual Studio 2015 cache/options directory
.vs/
-
3That can help someone to decide (lazily), but does not give strong advise or any reason to do so. The title ("Visual Studio 2015 cache/options directory") helps more in deciding. Commented Nov 27, 2016 at 6:58
-
1
As described in the quote taken from uservoice in Patrick's answer, the folder is not intended for source control.
However like comments also point out, there can be some cases where you would want to include specific files from the folder.
I would add this to .gitignore:
.vs/
And then use whatever git tool you prefer to add certain files like a shared configuration of the applicationhost.config if needed.
Or use a git command like this:
git add -f .vs/config/applicationhost.config
This way git adds the file, even if it is ignored.
-
4I would like to add that if you're using TFS, you can use the negate prefix in your .tfignore file to "re-include" an applicationhost.config file after excluding the .vs folder. The default .tfignore file explains it like this: "The ! prefix negates a pattern. This can be used to re-include an item after it was excluded by a .tfignore file higher in the tree, or by the Team Project Collection's global exclusions list."– AaronCommented Jan 1, 2018 at 23:58