如何在Visual Studio解决方案文件中设置默认配置?

时间:2021-07-28 00:22:19

In VS2005 and up, is it possible to specify which configuration should be selected by default?

在VS2005及更高版本中,是否可以指定默认选择哪个配置?

I have several configurations in my solution but one of them should be used in most cases. Hence I'd like to make sure that devs who pull it out of Source Control use the right configuration(unless of course they specifically choose another one).

我的解决方案中有几种配置,但在大多数情况下应该使用其中一种配置。因此,我想确保将其从源代码管理中删除的开发人员使用正确的配置(除非他们特别选择另一个)。

Ideally, this setting should be in the .sln file since that one is under Source Control.

理想情况下,此设置应位于.sln文件中,因为该文件位于源代码管理下。

3 个解决方案

#1


12  

As far as I understand, if there is no .suo file, first platform in alphabetic order becomes the default configuration.

据我所知,如果没有.suo文件,则按字母顺序排列的第一个平台将成为默认配置。

#2


8  

This is pretty old, but this was helpful for me:

这很老了,但这对我有帮助:

It by default picks its platform as Mixed Platform. If that doesn't exist, it picks the first listed in your .sln file.

它默认选择其平台作为混合平台。如果不存在,则会选择.sln文件中列出的第一个。

The default configuration is something that starts with Debug. So if you have something called Debug Test, it will select that. If that doesn't exist, it goes by order in your .sln file. It will not pick Test Debug over Debug.

默认配置是以Debug开头的。所以如果你有一个名为Debug Test的东西,它会选择它。如果不存在,则按.sln文件中的顺序排序。它不会选择Test Debug over Debug。

#3


1  

I don't know if I understand the complete situation behind your question, but there is a way to "externalize" some of VS.Net's project configuration values such as FxCop settings into a separate file. Then you could have all projects in a solution point to that file. However, I don't think it would allow for your devs to chose their own configuration after doing the "externalization"

我不知道我是否理解你的问题背后的完整情况,但是有一种方法可以将VS.Net的一些项目配置值(如FxCop设置)“外部化”到一个单独的文件中。然后,您可以让解决方案中的所有项目都指向该文件。但是,我不认为它会让你的开发人员在做“外化”后选择自己的配置

If this seems like the right path for you, check out these posts from me in regards to coding standards on how to make similar changes for configuration.

如果这对您来说似乎是正确的路径,请查看我关于如何对配置进行类似更改的编码标准的这些帖子。

#1


12  

As far as I understand, if there is no .suo file, first platform in alphabetic order becomes the default configuration.

据我所知,如果没有.suo文件,则按字母顺序排列的第一个平台将成为默认配置。

#2


8  

This is pretty old, but this was helpful for me:

这很老了,但这对我有帮助:

It by default picks its platform as Mixed Platform. If that doesn't exist, it picks the first listed in your .sln file.

它默认选择其平台作为混合平台。如果不存在,则会选择.sln文件中列出的第一个。

The default configuration is something that starts with Debug. So if you have something called Debug Test, it will select that. If that doesn't exist, it goes by order in your .sln file. It will not pick Test Debug over Debug.

默认配置是以Debug开头的。所以如果你有一个名为Debug Test的东西,它会选择它。如果不存在,则按.sln文件中的顺序排序。它不会选择Test Debug over Debug。

#3


1  

I don't know if I understand the complete situation behind your question, but there is a way to "externalize" some of VS.Net's project configuration values such as FxCop settings into a separate file. Then you could have all projects in a solution point to that file. However, I don't think it would allow for your devs to chose their own configuration after doing the "externalization"

我不知道我是否理解你的问题背后的完整情况,但是有一种方法可以将VS.Net的一些项目配置值(如FxCop设置)“外部化”到一个单独的文件中。然后,您可以让解决方案中的所有项目都指向该文件。但是,我不认为它会让你的开发人员在做“外化”后选择自己的配置

If this seems like the right path for you, check out these posts from me in regards to coding standards on how to make similar changes for configuration.

如果这对您来说似乎是正确的路径,请查看我关于如何对配置进行类似更改的编码标准的这些帖子。