Mercurial .hgignore for Visual Studio 2012 projects
Asked Answered
B

2

37

I currently use the answer to a similar question for Visual Studio 2010 as my go to hgignore file. Are there any notable additions to include with VS2012?


Below is a compiled list from many different sources. Gist here.

I have found that projects upgraded from VS2010 have a lot of backup and upgrade log files not required.

# use glob syntax
syntax: glob

*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]humbs.db
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.resharper

# For projects upgraded from VS2010
[Bb]ackup/
_UpgradeReport_Files/
UpgradeLog.*

*.opensdf
*.sdf
ipch/
x64/
Babb answered 3/10, 2012 at 13:22 Comment(0)
S
60

By pulling from this previous answer about Visual Studio 2010, from this response in this question, and this wonderful citation I compiled this listing:

############################################################
## Visual Studio 2012
############################################################
syntax: glob

## User-specific files

*.suo
*.user
*.sln.docstates

## Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

## MSTest test Results

[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.scc

## Visual C++ cache files

ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

## Visual Studio profiler

*.psess
*.vsp
*.vspx

## Guidance Automation Toolkit

*.gpState

## ReSharper Ignores

_ReSharper*/
*.[Rr]e[Ss]harper

## TeamCity Ignores
_TeamCity*

## DotCover Ignores

*.dotCover

## NCrunch Ignores

*.ncrunch*
.*crunch*.local.xml

## Installshield output folder
[Ee]xpress/

## DocProject Ignores

DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

## Click-Once Ignores

publish/

## Publish Web Output

*.Publish.xml
*.pubxml

## Windows Azure Build Ignores

csx
*.build.csdef

## Windows Store Ignores

AppPackages/

## RIA/Silverlight projects

Generated_Code/

## SQL Server Ignores

App_Data/*.mdf
App_Data/*.ldf

## Backup & Report Files when converting a solution
## Not required, we have mercurial!

_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

## NuGet
packages/

## Miscellaneous Ignores

sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

## Windows Ignores

$RECYCLE.BIN/
Thumbs.db
ehthumbs.db
Desktop.ini

This is currently working great in my repositories.

Scranton answered 19/10, 2012 at 19:31 Comment(5)
There might be a number of lines to add from the "official" .gitignore file for Visual Studio (the formats looks very similar): github.com/github/gitignore/blob/master/VisualStudio.gitignoreSuomi
In fact if you compare them this is almost line for line the same (bar commenting differences etc) which would make sense as they are trying to do the same time! :)Wilson
Great stuff, for me it was only missing the packages folder for nuget (got restore enabled, no reason to push them), I also followed the /* comment from VS2010 question so it will not drop files beginning with folder names, although I never name files like that..Granddaddy
@JonathanLevison I just added it!Scranton
Warning: I found that some Debug subfolders of included third-party website tools were being unnecessarily excluded. Be aware that ignore entries can be rooted using regex e.g. [Dd]ebug*/ will unnecessarily match every folder named Debug everywhere whereas ^[Bb]in/[Dd]ebug*/ will match the ASP.NET Debug folder. See also - #9051690Weigel
T
2

I generally build them as I go but this is a good starting point that I currently use for a fairly complex project. The ipch/ directory is the only new thing in VS2012.

ipch/
x64/
*Debug/
*Release/
TestResults/
*sdf
*.suo
*.user

*Debug/ and *Release handle device drivers that target Win7 Release, for example. There are *.opensdf and *.sdf files that can be listed separately if desired.

Thach answered 4/10, 2012 at 3:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.