Subversion 和 Visual Studio 项目的最佳实践
我最近开始在 Visual Studio 中处理各种 C# 项目,作为大型系统计划的一部分,该系统将用于替换我们当前的系统,该系统是由用 C 和 Perl 编写的各种程序和脚本拼凑而成的。我现在正在进行的项目已经达到了颠覆的临界点。我想知道什么应该和不应该提交到 Visual Studio 项目的存储库。我知道它将生成各种文件,这些文件只是构建工件,并不真正需要提交,我想知道是否有人对在 Visual Studio 中正确使用 SVN 有任何建议。目前,我正在使用带有 Visual Studio 2010 beta 的 SVN 1.6 服务器。欢迎任何建议、意见。
I've recently started working on various C# projects in Visual Studio as part of a plan for a large scale system that will be used to replace our current system that's built from a cobbling-together of various programs and scripts written in C and Perl. The projects I'm now working on have reached critical mass for being committed to subversion. I was wondering what should and should not be committed to the repository for Visual Studio projects. I know that it's going to generate various files that are just build-artifacts and don't really need to be committed, and I was wondering if anybody had any advice for properly using SVN with Visual Studio. At the moment, I'm using an SVN 1.6 server with Visual Studio 2010 beta. Any advice, opinions are welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
根据 MSDN:
According to MSDN:
我建议使用 AnkhSVN - Visual Studio 2008/2010 的 Subversion 源代码控制插件。
您可以使用它来执行解决方案、项目和源代码的初始添加和提交到存储库,并且它不会添加任何构建工件。它不会添加您的构建生成的任何内容,只会添加您的解决方案引用的文件。如果解决方案中没有您需要的任何其他零碎内容,您可以稍后添加它们。
I would suggest using AnkhSVN - a Subversion source control plugin for Visual Studio 2008/2010.
You can use it to perform your initial add and commit of the solution, projects and sources to the repository and it won't add any of the build artefacts. It won't add anything that is generated by your build, only files that are referenced by your solution. If there are any other bits and pieces you need that aren't in your solution, you can add them afterwards.
将以下文件放入版本控制中:
工件>不将以下文件放入版本控制中:
另外,不要放入任何目标文件、可执行文件、自动生成的文件(如可能生成的标头)。
至于可执行文件和其他生成的文件 - 如果您希望能够存档版本,则可能会有例外。这可能是个好主意,但您可能希望以稍微不同的方式进行管理,并且可能需要在与源代码不同的位置进行管理。如果您这样做,还要存档您的 .pdb 文件,以便稍后调试这些内容。您可能希望使用符号服务器来存储存档的符号(请参阅Windows 调试工具 用于符号服务器及其文档)。
以下是我从 SVN 中排除的 VS 特定文件的列表:
Put the following files in version control:
Do not put the following files into version control:
Also, don't put in any object files, executables, auto-generated files (like headers that might be generated).
As for executables and other generated files - there might be an exception if you want to be able to archive releases. That might be a good idea, but you'll probably want to manage that a little differently and possibly in a different place than your source code. If you do this, also archive your .pdb files so you can debug the stuff later. you might want to use a Symbol Server to store you archived symbols (see Debugging Tools for Windows for the symbol server and its documentation).
Here's my list of VS-specific files that I exclude from SVN:
解决方案级别:
.sln
解决方案文件.suo
解决方案用户选项文件项目级别:
.csproj
、。 vbproj
(和 c++ proj?)文件.csproj.user
,.vbproj.user
文件bin
目录obj
目录如果您使用 VS 插件,它们可能会生成也需要忽略的文件(即 ReSharper 生成
.resharper
和.resharper.user
文件)。忽略项可以通过文件名(即
MyProject.csproj
)或通配符模式(即*.csproj.user
)显式忽略。一旦你设置了忽略,检查源代码的干净副本,然后构建应该不会显示任何修改(即没有新的未版本控制的文件)。
Solution level:
.sln
solution file.suo
solution user options fileProject level:
.csproj
,.vbproj
(and c++ proj?) files.csproj.user
,.vbproj.user
filesbin
directoryobj
directoryIf you use and VS addins, they may generate files that also need ignoring (ie. ReSharper generates
.resharper
and.resharper.user
files).The ignore items can either be ignored explicitly by filename (ie.
MyProject.csproj
), or by a wildcard pattern (ie.*.csproj.user
).Once you have your ignores set up, checking out a clean copy of your source then building should then show no modifications (ie. no new unversioned files).
我会手动包含所有我认为不应该进行版本控制的文件。
我的全局忽略模式是:
.dll .pdb .exe .cache .webinfo .snk bin obj debug _Resharper .user resharper
I would manually include all files that I think I shouldn't version control.
My global ignore pattern is:
.dll .pdb .exe .cache .webinfo .snk bin obj debug _Resharper .user resharper
如果您使用忽略列表,SVN 区分大小写。所以记得分别忽略 bin 和 Bin 文件夹。
另外,我有一个问题..为什么有时需要很长时间才能刷新状态图标?有时它会变得非常混乱。
In case you are using ignore list, SVN is case sensitive. So remember to ignore bin and Bin folders separately.
Also, I had a question.. why does it take lot of time some times to refresh the status icon? At times it gets very confusing.
有关 Mercurial 忽略列表,请参阅 Mercurial .hgignore for Visual Studio 2008 项目 。我不熟悉 SVN 忽略列表的语法,但此线程有一些在 Visual Studio 中要忽略的内容的好列表。
See Mercurial .hgignore for Visual Studio 2008 projects for a Mercurial ignore list. I'm not familiar with the syntax of the SVN ignore list but this thread has a few good lists of what to ignore in Visual Studio.