我应该将Visual Studio .suo和.user文件添加到源代码管理中吗?

时间:2023-01-14 21:30:55

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?

Visual Studio解决方案包含两种类型的隐藏用户文件。一个是解决方案.suo文件,它是一个二进制文件。另一个是项目.user文件,它是一个文本文件。这些文件包含的确切数据是什么?

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?

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

18 个解决方案

#1


630  

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

这些文件包含通常特定于您的计算机的用户首选项配置,因此最好不要将其放在SCM中。此外,VS几乎每次执行时都会更改它,因此SCM始终将其标记为“已更改”。我也不包括,我在使用VS 2年的项目中并没有遇到任何问题。唯一的小麻烦是调试参数(执行路径,部署目标等)存储在其中一个文件中(不知道哪个),所以如果你有一个标准,你将无法'通过SCM发布它,让其他开发人员将整个开发环境“随时可用”。

#2


130  

You don't need to add these -- they contain per-user settings, and other developers won't want your copy.

您不需要添加这些 - 它们包含每个用户的设置,而其他开发人员则不需要您的副本。

#3


65  

Others have explained why having the *.suo and *.user files under source control is not a good idea.

其他人解释了为什么在源代码控制下使用* .suo和* .user文件不是一个好主意。

I'd like to suggest that you add these patterns to the svn:ignore property for 2 reasons:

我想建议你将这些模式添加到svn:ignore属性有两个原因:

  1. So other developers won't wind up with one developer's settings.
  2. 因此,其他开发人员不会满足于一个开发人员的设置。

  3. So when you view status, or commit files, those files won't clutter the code base and obscure new files you need to add.
  4. 因此,当您查看状态或提交文件时,这些文件不会混淆代码库并隐藏您需要添加的新文件。

#4


47  

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.

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

Hope this helps.

希望这可以帮助。

#5


25  

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.

自从我在2011年通过Google发现这个问题/答案以来,我想我会花一点时间将Visual Studio 2010创建的* .SDF文件的链接添加到可能不应添加到版本控制的文件列表中( IDE将重新创建它们)。由于我不确定* .sdf文件是否可能在其他地方合法使用,我只忽略了SVN中的特定[projectname] .sdf文件。

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

为什么Visual Studio转换向导2010会创建大量SDF数据库文件?

#6


22  

No, you should not add them to source control since - as you said - they're user specific.

不,你不应该将它们添加到源代码管理中,因为 - 如你所说 - 它们是用户特定的。

SUO (Solution User Options): Records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made.

SUO(解决方案用户选项):记录您可能与解决方案关联的所有选项,以便每次打开它时,它都包含您所做的自定义。

The .user file contains the user options for the project (while SUO is for the solution) and extends the project file name (e.g. anything.csproj.user contains user settings for the anything.csproj project).

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

#7


17  

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.

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

#8


16  

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

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

Adding (and editing) .suo files to source control

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

我不知道为什么你的项目将DebuggingWorkingDirectory存储在suo文件中。如果这是特定于用户的设置,则应考虑将其存储在* .proj.user文件名中。如果该设置在项目的所有用户之间可共享,则应考虑将其存储在项目文件中。

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

甚至不想将suo文件添加到源代码管理中! SUO(soluton用户选项)文件旨在包含特定于用户的设置,不应在使用同一解决方案的用户之间共享。如果你要在scc数据库中添加suo文件,我不知道IDE中你还有什么其他的东西,但从源代码管理的角度来看,你将破坏web项目的scc集成,使用Lan vs Internet插件由不同的用户进行VSS访问,甚至可能导致scc完全中断(存储在suo文件中的VSS数据库路径可能对其他用户有效)。

Alin Constantin (MSFT)

艾琳·康斯坦丁(MSFT)

#9


11  

Visual Studio will automatically create them. I don't recommend putting them in source control. There have been numerous times where a local developer's SOU file was causing VS to behave erratically on that developers box. Deleting the file and then letting VS recreate it always fixed the issues.

Visual Studio将自动创建它们。我不建议将它们放在源代码管理中。很多时候,本地开发人员的SOU文件导致VS在开发人员盒子上表现不正常。删除文件然后让VS重新创建它总是修复问题。

#10


10  

On the MSDN website, it clearly states that

在MSDN网站上,它明确指出

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

解决方案用户选项(.suo)文件包含每用户解决方案选项。不应将此文件签入源代码控制。

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

所以我会说在检查源代码控制的东西时忽略这些文件是相当安全的。

#11


8  

I wouldn't. Anything that could change per "user" is usually not good in source control. .suo, .user, obj/bin directories

我不会。任何可能因“用户”而改变的东西在源代码控制中通常都不好。 .suo,.user,obj / bin目录

#12


7  

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.

这些文件是特定于用户的选项,应独立于解决方案本身。 Visual Studio将根据需要创建新的,因此不需要签入源代码控制。实际上,最好不要这样做,因为这允许个别开发人员根据自己的需要定制他们的环境。

#13


6  

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.

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

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

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

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.

在我们公司,我们不会将这些文件置于源代码管理之下。

#14


6  

They contain the specific settings about the project that are typically assigned to a single developer (like, for example, the starting project and starting page to start when you debug your application).

它们包含有关项目的特定设置,这些设置通常分配给单个开发人员(例如,在调试应用程序时启动的起始项目和起始页)。

So it's better not adding them to version control, leaving VS recreate them so that each developer can have the specific settings they want.

因此最好不要将它们添加到版本控制中,让VS重新创建它们,以便每个开发人员都可以拥有他们想要的特定设置。

#15


4  

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

.user是用户设置,我认为.suo是解决方案用户选项。您不希望这些文件受源代码控制;它们将为每个用户重新创建。

#16


3  

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

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

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

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

#17


0  

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

如果在ProjectProperties> Debugging> Environment中设置可执行目录依赖项,则路径将存储在“.user”文件中。

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

假设我在上面提到的字段中设置了这个字符串:“PATH = C:\ xyz \ bin”这就是它将如何存储在'.user'文件中:

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

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

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

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

#18


0  

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.

不要将任何这些文件添加到版本控制中。如果签入版本控制将导致其他工作站出现问题,这些文件将自动生成工作站特定信息。

#1


630  

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

这些文件包含通常特定于您的计算机的用户首选项配置,因此最好不要将其放在SCM中。此外,VS几乎每次执行时都会更改它,因此SCM始终将其标记为“已更改”。我也不包括,我在使用VS 2年的项目中并没有遇到任何问题。唯一的小麻烦是调试参数(执行路径,部署目标等)存储在其中一个文件中(不知道哪个),所以如果你有一个标准,你将无法'通过SCM发布它,让其他开发人员将整个开发环境“随时可用”。

#2


130  

You don't need to add these -- they contain per-user settings, and other developers won't want your copy.

您不需要添加这些 - 它们包含每个用户的设置,而其他开发人员则不需要您的副本。

#3


65  

Others have explained why having the *.suo and *.user files under source control is not a good idea.

其他人解释了为什么在源代码控制下使用* .suo和* .user文件不是一个好主意。

I'd like to suggest that you add these patterns to the svn:ignore property for 2 reasons:

我想建议你将这些模式添加到svn:ignore属性有两个原因:

  1. So other developers won't wind up with one developer's settings.
  2. 因此,其他开发人员不会满足于一个开发人员的设置。

  3. So when you view status, or commit files, those files won't clutter the code base and obscure new files you need to add.
  4. 因此,当您查看状态或提交文件时,这些文件不会混淆代码库并隐藏您需要添加的新文件。

#4


47  

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.

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

Hope this helps.

希望这可以帮助。

#5


25  

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.

自从我在2011年通过Google发现这个问题/答案以来,我想我会花一点时间将Visual Studio 2010创建的* .SDF文件的链接添加到可能不应添加到版本控制的文件列表中( IDE将重新创建它们)。由于我不确定* .sdf文件是否可能在其他地方合法使用,我只忽略了SVN中的特定[projectname] .sdf文件。

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

为什么Visual Studio转换向导2010会创建大量SDF数据库文件?

#6


22  

No, you should not add them to source control since - as you said - they're user specific.

不,你不应该将它们添加到源代码管理中,因为 - 如你所说 - 它们是用户特定的。

SUO (Solution User Options): Records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made.

SUO(解决方案用户选项):记录您可能与解决方案关联的所有选项,以便每次打开它时,它都包含您所做的自定义。

The .user file contains the user options for the project (while SUO is for the solution) and extends the project file name (e.g. anything.csproj.user contains user settings for the anything.csproj project).

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

#7


17  

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.

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

#8


16  

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

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

Adding (and editing) .suo files to source control

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

我不知道为什么你的项目将DebuggingWorkingDirectory存储在suo文件中。如果这是特定于用户的设置,则应考虑将其存储在* .proj.user文件名中。如果该设置在项目的所有用户之间可共享,则应考虑将其存储在项目文件中。

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

甚至不想将suo文件添加到源代码管理中! SUO(soluton用户选项)文件旨在包含特定于用户的设置,不应在使用同一解决方案的用户之间共享。如果你要在scc数据库中添加suo文件,我不知道IDE中你还有什么其他的东西,但从源代码管理的角度来看,你将破坏web项目的scc集成,使用Lan vs Internet插件由不同的用户进行VSS访问,甚至可能导致scc完全中断(存储在suo文件中的VSS数据库路径可能对其他用户有效)。

Alin Constantin (MSFT)

艾琳·康斯坦丁(MSFT)

#9


11  

Visual Studio will automatically create them. I don't recommend putting them in source control. There have been numerous times where a local developer's SOU file was causing VS to behave erratically on that developers box. Deleting the file and then letting VS recreate it always fixed the issues.

Visual Studio将自动创建它们。我不建议将它们放在源代码管理中。很多时候,本地开发人员的SOU文件导致VS在开发人员盒子上表现不正常。删除文件然后让VS重新创建它总是修复问题。

#10


10  

On the MSDN website, it clearly states that

在MSDN网站上,它明确指出

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

解决方案用户选项(.suo)文件包含每用户解决方案选项。不应将此文件签入源代码控制。

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

所以我会说在检查源代码控制的东西时忽略这些文件是相当安全的。

#11


8  

I wouldn't. Anything that could change per "user" is usually not good in source control. .suo, .user, obj/bin directories

我不会。任何可能因“用户”而改变的东西在源代码控制中通常都不好。 .suo,.user,obj / bin目录

#12


7  

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.

这些文件是特定于用户的选项,应独立于解决方案本身。 Visual Studio将根据需要创建新的,因此不需要签入源代码控制。实际上,最好不要这样做,因为这允许个别开发人员根据自己的需要定制他们的环境。

#13


6  

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.

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

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

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

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.

在我们公司,我们不会将这些文件置于源代码管理之下。

#14


6  

They contain the specific settings about the project that are typically assigned to a single developer (like, for example, the starting project and starting page to start when you debug your application).

它们包含有关项目的特定设置,这些设置通常分配给单个开发人员(例如,在调试应用程序时启动的起始项目和起始页)。

So it's better not adding them to version control, leaving VS recreate them so that each developer can have the specific settings they want.

因此最好不要将它们添加到版本控制中,让VS重新创建它们,以便每个开发人员都可以拥有他们想要的特定设置。

#15


4  

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

.user是用户设置,我认为.suo是解决方案用户选项。您不希望这些文件受源代码控制;它们将为每个用户重新创建。

#16


3  

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

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

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

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

#17


0  

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

如果在ProjectProperties> Debugging> Environment中设置可执行目录依赖项,则路径将存储在“.user”文件中。

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

假设我在上面提到的字段中设置了这个字符串:“PATH = C:\ xyz \ bin”这就是它将如何存储在'.user'文件中:

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

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

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

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

#18


0  

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.

不要将任何这些文件添加到版本控制中。如果签入版本控制将导致其他工作站出现问题,这些文件将自动生成工作站特定信息。