Should I add the Visual Studio .suo and .user file

2019-01-03 00:51发布

Visual Studio solutions contain two types of hidden user files. One is the solution .suo file which is a binary file. The other is the project .user file which is a text file. Exactly what data do these files contain?

I've also been wondering whether I should add these files to source control (Subversion in my case). If I don't add these files and another developer checks out the solution, will Visual Studio automatically create new user files?

18条回答
Emotional °昔
2楼-- · 2019-01-03 01:08

Don't add any of those files into version control. These files are auto generated with work station specific information, if checked-in to version control that will cause trouble in other work stations.

查看更多
女痞
3楼-- · 2019-01-03 01:09

These files are user-specific options, which should be independent of the solution itself. Visual Studio will create new ones as necessary, so they do not need to be checked in to source control. Indeed, it would probably be better not to as this allows individual developers to customize their environment as they see fit.

查看更多
在下西门庆
4楼-- · 2019-01-03 01:11

If you set your executable dir dependencies in ProjectProperties>Debugging>Environment, the paths are stored in '.user' files.

Suppose I set this string in above-mentioned field: "PATH=C:\xyz\bin" This is how it will get stored in '.user' file:

<LocalDebuggerEnvironment>PATH=C:\xyz\bin$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>

This helped us a lot while working in OpenCV. We could use different versions of OpenCV for different projects. Another advantage is, it was very easy to set up our projects on a new machine. We just had to copy corresponding dependency dirs. So for some projects, I prefer to add the '.user' to source control.

Even though, it is entirely dependent on projects. You can take a call based on your needs.

查看更多
闹够了就滚
5楼-- · 2019-01-03 01:12

You cannot source-control the .user files, because that's user specific. It contains the name of remote machine and other user-dependent things. It's a vcproj related file.

The .suo file is a sln related file and it contains the "solution user options" (startup project(s), windows position (what's docked and where, what's floating), etc.)

It's a binary file, and I don't know if it contains something "user related".

In our company we do not take those files under source control.

查看更多
孤傲高冷的网名
6楼-- · 2019-01-03 01:15

We don't commit the binary file (*.suo), but we commit the .user file. The .user file contains for example the start options for debugging the project. You can find the start options in the properties of the project in the tab "Debug". We used NUnit in some projects and configured the nunit-gui.exe as the start option for the project. Without the .user file, each team member would have to configure it separately.

Hope this helps.

查看更多
成全新的幸福
7楼-- · 2019-01-03 01:15

By default Microsoft's Visual SourceSafe does not include these files in the source control because they are user-specific settings files. I would follow that model if you're using SVN as source control.

查看更多
登录 后发表回答