Mercurial .hgignore for Visual Studio 2008 project

2019-01-04 15:28发布

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/

7条回答
戒情不戒烟
2楼-- · 2019-01-04 15:49

Here are a couple pesky ones: Matlab and Excel/Office autosaves.

# use glob syntax
syntax: glob

# Matlab ignore files
*.asv

# Microsoft Office
~$*

If I accidentally add them and then close the real file that was open, Excel and/or Matlab will delete the auto-save and then Mercurial will be stuck wondering where they went. I'm sure there are other programs that do similar things.

查看更多
祖国的老花朵
3楼-- · 2019-01-04 15:53

This is specific to a C# project, but I ignore these files/directories:

  • *.csproj.user
  • /obj/*
  • /bin/*
  • *.ncb
  • *.suo

I have no problems running the code in the depot on other machines after I ignore all of these files. The easiest way to find out what you need to keep is to make a copy of the folder and start deleting things you think aren't necessary. Keep trying to build, and as long as you can build successfully keep on deleting. If you delete too much, copy it from the source folder.

In the end you'll have a nice directory full of the only files that have to be committed.

查看更多
smile是对你的礼貌
4楼-- · 2019-01-04 15:53

some others I use:

output
PrecompiledWeb
_UpgradeReport_Files

#Guidance Automation Toolkit
*.gpState
#patches
*.patch
查看更多
做个烂人
5楼-- · 2019-01-04 15:55

Here is the content of my .hgignore for C# Visual Studio projects:

syntax: glob
*.user
*.ncb
*.nlb
*.suo
*.aps
*.clw
*.pdb
*\Debug\*
*\Release\*

A few notes:

  1. If you have custom "releases" besides "Debug" and "Release", you may need to add them.
  2. Be careful when you manually edit your .hgignore. If you make a syntax error, then hgtortoise will no longer open the commit dialog.
查看更多
来,给爷笑一个
6楼-- · 2019-01-04 16:01

I feel left out of the conversation. Here's my .hgignore file. It covers C#, C++ and Visual Studio development in general, including COM stuff (type libraries), some final builder files, CodeRush, ReSharper, and Visual Studio project upgrades. It also has some ignores for modern (c.2015) web development.

syntax: glob

* - [Cc]opy
* - [Cc]opy/
* - [Cc]opy (?)/
* - [Cc]opy.*
* - [Cc]opy (?).*
**/.*
**/scss/*.css
*.*scc
*.FileListAbsolute.txt
*.aps
*.bak
*.bin
*.[Cc]ache
*.clw
*.css.map
*.eto
*.exe
*.fb6lck
*.fbl6
*.fbpInf
*.ilk
*.lib
*.log
*.ncb
*.nlb
*.nupkg
*.obj
*.old
*.orig
*.patch
*.pch
*.pdb
*.plg
*.[Pp]ublish.xml
*.rdl.data
*.sbr
*.scc
*.sig
*.sqlsuo
*.suo
*.svclog
*.tlb
*.tlh
*.tli
*.tmp
*.user
*.vshost.*
*.docstates
*DXCore.Solution
*_i.c
*_p.c
__MVC_BACKUP/
_[Rr]e[Ss]harper.*/
_UpgradeReport_Files/
Ankh.Load
Backup*
[Bb]in/
bower_components/
[Bb]uild/
CVS/
[Dd]ebug/
[Ee]xternal/
hgignore[.-]*
ignore[.-]*
lint.db
node_modules/
[Oo]bj/
[Pp]ackages/
PrecompiledWeb/
[Pp]ublished/
[Rr]elease/
svnignore[.-]*
[Tt]humbs.db
UpgradeLog*.*
查看更多
狗以群分
7楼-- · 2019-01-04 16:03

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
查看更多
登录 后发表回答