Visual Studio解决方案包含两种类型的隐藏用户文件。一个是解决方案。suo文件,这是一个二进制文件。另一个是project .user文件,它是一个文本文件。这些文件到底包含哪些数据?
我也一直在考虑是否应该将这些文件添加到源代码控制(在我的情况下是Subversion)。如果我没有添加这些文件,而另一个开发人员签出了解决方案,Visual Studio会自动创建新的用户文件吗?
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)
其他回答
您不能对.user文件进行源代码控制,因为这是特定于用户的。它包含远程机器的名称和其他与用户相关的内容。这是一个vcproj相关的文件。
suo文件是一个sln相关的文件,它包含“解决方案用户选项”(启动项目,窗口位置(停靠的内容和位置,浮动的内容),等等。
这是一个二进制文件,我不知道它是否包含“用户相关”的内容。
在我们公司,我们不把这些文件置于源代码控制之下。
你不需要添加这些——它们包含每个用户的设置,其他开发人员不会想要你的副本。
Visual Studio会自动创建它们。我不建议把它们放在源代码控制中。曾经有很多次,本地开发人员的SOU文件导致VS在开发人员的盒子上表现不稳定。删除文件,然后让VS重新创建它总是修复问题。
它们包含有关项目的特定设置,这些设置通常分配给单个开发人员(例如,在调试应用程序时启动的启动项目和开始页面)。
所以最好不要把它们添加到版本控制中,让VS重新创建它们,这样每个开发人员都可以有他们想要的特定设置。
这些文件是特定于用户的选项,应该独立于解决方案本身。Visual Studio会根据需要创建新的,所以它们不需要检入到源代码控制中。实际上,最好不要这样做,因为这样可以让开发人员根据自己的需要定制自己的环境。