Visual Studio Version Control With Mercurial

Article by:
Date Published:
Last Modified:

Overview

Following is an Mercurial ignore file for excluding the unnecessary files from a Visual Studio C# project (written when using the 2010 version, but should work with others). The ignore file is written using regex syntax.

It only excludes files that are within a folder called . This is to stop the ignore file excluding other files with the same extension from other sections of the repository. Replace with whatever folder name you choose to put the code in, or delete / completely and it will ignore these files anywhere in your repository.

The type of file excluded is commented beside each line, just incase you want to re-introduce some of these files for some reason.

Copy this code into the .hgignore file found in the root directory of your repository.

Ignore File

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#*************************************************************************
#***************************** C# IGNORE FILES ***************************
#*************************************************************************

# use regexp syntax
syntax: regexp

# Files that should be included:
# .cs, .dll, .sln, .csproj, .resx, .config, .settings

<Visual Studio root folder>/.*\.pdb$    # 
<Visual Studio root folder>/.*\.user$   # User files
<Visual Studio root folder>/.*\.suo$
<Visual Studio root folder>/.*\.obj$    # Temp build files
<Visual Studio root folder>/.*\.pch$
<Visual Studio root folder>/.*\.vspscc$
<Visual Studio root folder>/.*\._i\.c$
<Visual Studio root folder>/.*\._p\.c$
<Visual Studio root folder>/.*\.ncb$
<Visual Studio root folder>/.*\.tlb$
<Visual Studio root folder>/.*\.tlh$
<Visual Studio root folder>/.*\.bak$
<Visual Studio root folder>/.*\.cache$
<Visual Studio root folder>/.*\.ilk$
<Visual Studio root folder>/.*\.log$
<Visual Studio root folder>/.*\.lib$
<Visual Studio root folder>/.*\.sbr$
<Visual Studio root folder>/.*\.scc$

<Visual Studio root folder>/.*obj/.* 		# All files in "obj" folder (temporary object files for creating binary with
<Visual Studio root folder>/.*Debug/.* 		# All files in "obj" folder (temporary object files for creating binary with

# InstallShield Files (all logfiles and reports)
<Visual Studio root folder>/.*?/DVD-5/LogFiles/.*?
<Visual Studio root folder>/.*?/DVD-5/Reports/.*?
<Visual Studio root folder>/.*?/SingleImage/LogFiles/.*?
<Visual Studio root folder>/.*?/SingleImage/Reports/.*?

Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Tags

    comments powered by Disqus