visual-studio 用于 Visual Studio 2008 项目的 Mercurial .hgignore
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mercurial .hgignore for Visual Studio 2008 projects
提问by Johannes
What is a good setup for .hgignore file when working with Visual Studio 2008?
使用 Visual Studio 2008 时,.hgignore 文件的最佳设置是什么?
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?
我正在考虑 obj 文件夹、.suo、.sln、.user 文件等。它们可以被包含在内还是我不应该包含的文件?
Thanks!
谢谢!
p.s.: at the moment I do the following : ignore all .pdb files and all obj folders.
ps:目前我执行以下操作:忽略所有 .pdb 文件和所有 obj 文件夹。
# regexp syntax.
syntax: glob
*.pdb
syntax: regexp
/obj/
回答by Even Mien
Here's my standard .hgignore file for use with VS2008 that was originally modified from a Git ignore file:
这是我用于 VS2008 的标准 .hgignore 文件,它最初是从 Git 忽略文件修改而来的:
# 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
回答by Daniel Jennings
This is specific to a C# project, but I ignore these files/directories:
这是特定于 C# 项目的,但我忽略了这些文件/目录:
*.csproj.user/obj/*/bin/**.ncb*.suo
*.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.
最后,您将拥有一个完整的目录,其中包含必须提交的唯一文件。
回答by Damian Powell
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.
我觉得被排除在谈话之外。这是我的 .hgignore 文件。它涵盖了 C#、C++ 和 Visual Studio 开发的一般内容,包括 COM 内容(类型库)、一些最终构建器文件、CodeRush、ReSharper 和 Visual Studio 项目升级。对于现代(c.2015)Web 开发,它也有一些忽略。
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*.*
回答by jm.
Here is the content of my .hgignore for C# Visual Studio projects:
这是我的 C# Visual Studio 项目的 .hgignore 的内容:
syntax: glob
*.user
*.ncb
*.nlb
*.suo
*.aps
*.clw
*.pdb
*\Debug\*
*\Release\*
A few notes:
一些注意事项:
- If you have custom "releases" besides "Debug" and "Release", you may need to add them.
- Be careful when you manually edit your .hgignore. If you make a syntax error, then hgtortoise will no longer open the commit dialog.
- 如果您除了“调试”和“发布”之外还有自定义的“发布”,则可能需要添加它们。
- 手动编辑 .hgignore 时要小心。如果你犯了一个语法错误,那么 hgtortoise 将不再打开提交对话框。
回答by AlGonzalez
My Mercurial .hgignore file contents:
我的 Mercurial .hgignore 文件内容:
syntax: glob
#-- Files
*.bak.*
*.bak
thumbs.db
#-- Directories
App_Data/*
bin/
obj/
_ReSharper.*/
tmp/
#-- Microsoft Visual Studio specific
*.user
*.suo
#-- MonoDevelop specific
*.pidb
*.userprefs
*.usertasks
Keep in mind that I mainly work on WinForms, ASP.NET MVC and Mobile projects using Microsoft Visual Studio and occasionally MonoDevelop. Depending on your toolset and project types, you will probably encounter other files that should be ignored.
请记住,我主要使用 Microsoft Visual Studio 和偶尔使用 MonoDevelop 处理 WinForms、ASP.NET MVC 和 Mobile 项目。根据您的工具集和项目类型,您可能会遇到其他应该忽略的文件。
I try to keep the latest version on CodePaste.NET at http://codepaste.net/zxov7i
我尝试在http://codepaste.net/zxov7i上保留 CodePaste.NET 上的最新版本
回答by rohancragg
some others I use:
我使用的其他一些:
output
PrecompiledWeb
_UpgradeReport_Files
#Guidance Automation Toolkit
*.gpState
#patches
*.patch
回答by Nathan Donnellan
Here are a couple pesky ones: Matlab and Excel/Office autosaves.
这里有几个讨厌的:Matlab 和 Excel/Office 自动保存。
# 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.
如果我不小心添加了它们,然后关闭了打开的真实文件,Excel 和/或 Matlab 将删除自动保存,然后 Mercurial 将被困在想知道它们去了哪里。我敢肯定还有其他程序可以做类似的事情。

