Programming
visual-studio visual-studio-2008 mercurial hgignore
Updated Thu, 04 Aug 2022 12:15:54 GMT

Mercurial .hgignore for Visual Studio 2008 projects


What is a good setup for .hgignore file when working with Visual Studio 2008?

I mostly develop on my own, only occasionly I clone the repository for somebody else to work on it.

I'm thinking about obj folders, .suo, .sln, .user files etc.. Can they just be included or are there file I shouldn't include?

Thanks!

p.s.: at the moment I do the following : ignore all .pdb files and all obj folders.

# regexp syntax.
syntax: glob
*.pdb
syntax: regexp
/obj/



Solution

Here's my standard .hgignore file for use with VS2008 that was originally modified from a Git ignore file:

# Ignore file for Visual Studio 2008
# use glob syntax
syntax: glob
# Ignore Visual Studio 2008 files
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml




Comments (5)

  • +4 – No, but they have the same concept of an ignore file. — Jun 09, 2009 at 16:18  
  • +0 – @sebastiaan Only if the OP accepts his own answer: meta.stackexchange.com/questions/23049/… (and thanks!) — Apr 21, 2010 at 19:52  
  • +4 – I was looking for the ignore code that Rob Connery used in his Mercurial for Codeplex Tekpub video and it matched this exactl. Great job! — Sep 22, 2010 at 00:37  
  • +1 – For me this meant a file called Debug.Something.dll.config was ignored, so I think the trailing / on [Dd]ebug*/ doesn't have the desired effect. Perhaps for windows it should be [Dd]ebug*\ ? — Jan 21, 2011 at 15:01  
  • +2 – For me this meant a file called Debug.Something.dll.config was ignored, so I think the trailing / on [Dd]ebug*/ doesn't have the desired effect. I think the problem is with the glob-style syntax not correctly matching on directories. If you take out the Debug and Release lines and replace them with three new lines at the bottom of the file: syntax: regexp and [Rr]elease.*/ and [Dd]ebug.*/ then it seems to work correctly. — Jan 21, 2011 at 15:24