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

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


当前回答

这似乎是微软对此事的看法:

添加(并编辑).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)

其他回答

默认情况下,Microsoft的Visual SourceSafe在源代码控制中不包括这些文件,因为它们是用户特定的设置文件。如果您使用SVN作为源代码控制,我会遵循这个模型。

使用Rational ClearCase,答案是否定的。只有.sln & .*proj应该在源代码控制中注册。

我不能为其他供应商负责。如果我没记错的话,这些文件是“用户”特定的选项,您的环境。

如果你在ProjectProperties>Debugging>Environment中设置了可执行目录依赖项,路径将存储在'。用户的文件。

假设我在上面提到的字段中设置这个字符串:"PATH=C:\xyz\bin" 这就是它被存储在'中的方式。用户的文件:

< LocalDebuggerEnvironment >路径= C: \ xyz \ bin美元(LocalDebuggerEnvironment) < / LocalDebuggerEnvironment >

这对我们在OpenCV中工作有很大帮助。我们可以为不同的项目使用不同版本的OpenCV。另一个优点是,在新机器上建立我们的项目非常容易。我们只需要复制相应的依赖dirs。所以对于一些项目,我更喜欢添加'。用户'到源代码控制。

尽管如此,它完全依赖于项目。你可以根据自己的需要接听电话。

Visual Studio会自动创建它们。我不建议把它们放在源代码控制中。曾经有很多次,本地开发人员的SOU文件导致VS在开发人员的盒子上表现不稳定。删除文件,然后让VS重新创建它总是修复问题。

不要将这些文件添加到版本控制中。这些文件是自动生成的,包含特定于工作站的信息,如果签入到版本控制,将在其他工作站引起麻烦。