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条回答
欢心
2楼-- · 2019-01-03 01:16

.user is the user settings, and I think .suo is the solution user options. You don't want these files under source control; they will be re-created for each user.

查看更多
祖国的老花朵
3楼-- · 2019-01-03 01:19

Since I found this question/answer through Google in 2011, I thought I'd take a second and add the link for the *.SDF files created by Visual Studio 2010 to the list of files that probably should not be added to version control (the IDE will re-create them). Since I wasn't sure that a *.sdf file may have a legitimate use elsewhere, I only ignored the specific [projectname].sdf file from SVN.

Why does the Visual Studio conversion wizard 2010 create a massive SDF database file?

查看更多
放我归山
4楼-- · 2019-01-03 01:20

Using Rational ClearCase the answer is no. Only the .sln & .*proj should be registered in source code control.

I can't answer for other vendors. If I recall correctly, these files are "user" specific options, your environment.

查看更多
Explosion°爆炸
5楼-- · 2019-01-03 01:22

On the MSDN website, it clearly states that

The solution user options (.suo) file contains per-user solution options. This file should not be checked in to source code control.

So I'd say it is pretty safe to ignore these files while checking in stuff to your source control.

查看更多
Melony?
6楼-- · 2019-01-03 01:26

This appears to be Microsoft's opinion on the matter:

Adding (and editing) .suo files to source control

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)

查看更多
走好不送
7楼-- · 2019-01-03 01:27

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'.

查看更多
登录 后发表回答