Visual Studio解决方案包含两种类型的隐藏用户文件。一个是解决方案。suo文件,这是一个二进制文件。另一个是project .user文件,它是一个文本文件。这些文件到底包含哪些数据?

我也一直在考虑是否应该将这些文件添加到源代码控制(在我的情况下是Subversion)。如果我没有添加这些文件,而另一个开发人员签出了解决方案,Visual Studio会自动创建新的用户文件吗?


当前回答

不,它们不应该用于源代码控制,因为它们是开发人员/机器特定的本地设置。

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

其他回答

These files contain user preference configurations that are in general specific to your machine, so it's better not to put it in SCM. Also, VS will change it almost every time you execute it, so it will always be marked by the SCM as 'changed'. I don't include either, I'm in a project using VS for 2 years and had no problems doing that. The only minor annoyance is that the debug parameters (execution path, deployment target, etc.) are stored in one of those files (don't know which), so if you have a standard for them you won't be able to 'publish' it via SCM for other developers to have the entire development environment 'ready to use'.

你不需要添加这些——它们包含每个用户的设置,其他开发人员不会想要你的副本。

您不能对.user文件进行源代码控制,因为这是特定于用户的。它包含远程机器的名称和其他与用户相关的内容。这是一个vcproj相关的文件。

suo文件是一个sln相关的文件,它包含“解决方案用户选项”(启动项目,窗口位置(停靠的内容和位置,浮动的内容),等等。

这是一个二进制文件,我不知道它是否包含“用户相关”的内容。

在我们公司,我们不把这些文件置于源代码控制之下。

不,您不应该将它们添加到源代码控制中,因为—正如您所说—它们是特定于用户的。

SUO(解决方案用户选项):记录 所有可能的选择 把你的解决方案联系起来 每次你打开它,里面都有 自定义 取得了。

.user文件包含项目的用户选项(而SUO是解决方案)并扩展了项目文件名(例如anything.csproj.user包含anything.csproj.user的用户设置)。csproj项目)。

我们不提交二进制文件(*.suo),但我们提交.user文件。例如,.user文件包含用于调试项目的启动选项。你可以在“Debug”选项卡的项目属性中找到启动选项。我们在一些项目中使用了NUnit,并配置了NUnit -gui.exe作为项目的开始选项。如果没有.user文件,每个团队成员都必须单独配置它。

希望这能有所帮助。