Visual Studio解决方案包含两种类型的隐藏用户文件。一个是解决方案。suo文件,这是一个二进制文件。另一个是project .user文件,它是一个文本文件。这些文件到底包含哪些数据?
我也一直在考虑是否应该将这些文件添加到源代码控制(在我的情况下是Subversion)。如果我没有添加这些文件,而另一个开发人员签出了解决方案,Visual Studio会自动创建新的用户文件吗?
Visual Studio解决方案包含两种类型的隐藏用户文件。一个是解决方案。suo文件,这是一个二进制文件。另一个是project .user文件,它是一个文本文件。这些文件到底包含哪些数据?
我也一直在考虑是否应该将这些文件添加到源代码控制(在我的情况下是Subversion)。如果我没有添加这些文件,而另一个开发人员签出了解决方案,Visual Studio会自动创建新的用户文件吗?
当前回答
我们不提交二进制文件(*.suo),但我们提交.user文件。例如,.user文件包含用于调试项目的启动选项。你可以在“Debug”选项卡的项目属性中找到启动选项。我们在一些项目中使用了NUnit,并配置了NUnit -gui.exe作为项目的开始选项。如果没有.user文件,每个团队成员都必须单独配置它。
希望这能有所帮助。
其他回答
你不需要添加这些——它们包含每个用户的设置,其他开发人员不会想要你的副本。
这似乎是微软对此事的看法:
添加(并编辑).suo文件到源代码控制
I don't know why your project stores the DebuggingWorkingDirectory in the suo file. If that is a user specific setting you should consider storing that in the *.proj.user filename. If that setting is shareable between all users working on the project you should consider storing it in the project file itself. Don't even think of adding the suo file to source control! The SUO (soluton user options) file is meant to contain user-specific settings, and should not be shared amongst users working on the same solution. If you'd be adding the suo file in the scc database I don't know what other things in the IDE you'd break, but from source control point of view you will break web projects scc integration, the Lan vs Internet plugin used by different users for VSS access, and you could even cause the scc to break completely (VSS database path stored in suo file that may be valid for you may not be valid for another user). Alin Constantin (MSFT)
正如在其他回答中所解释的,.suo和.user都不应该被添加到源代码控制中,因为它们是特定于用户/机器的(顺便说一下,最新版本VS的.suo被转移到专用的临时目录。VS,应该完全远离源代码控制)。
然而,如果你的应用程序需要一些环境设置来在VS中调试(这样的设置通常保存在.user文件中),准备一个示例文件(命名为.user. sample)并将其添加到源代码控制中以供参考可能会很方便。
在这样的文件中使用相对路径或依赖于环境变量而不是硬编码绝对路径是有意义的,因此示例可能足够通用,可以很容易地被其他人重用。
不要将这些文件添加到版本控制中。这些文件是自动生成的,包含特定于工作站的信息,如果签入到版本控制,将在其他工作站引起麻烦。
不,它们不应该用于源代码控制,因为它们是开发人员/机器特定的本地设置。
GitHub在https://github.com/github/gitignore/blob/master/VisualStudio.gitignore上为VisualStudio用户提供了一个建议的文件类型列表
对于svn,我有以下global-ignore属性集:
* .DotSettings.User * .onetoc2 *。suo .vs预编译的web thumbs.db obj bin调试 *。user * * .vshost。 * .tss * .dbml.layout