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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/232881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 09:48:28  来源:igfitidea点击:

How to set a default configuration in a Visual Studio Solution File?

.netvisual-studiovisual-studio-2010visual-studio-2008target-platform

提问by Serge Wautier

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 文件中,因为该文件位于源代码管理之下。

采纳答案by abatishchev

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

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

回答by Ringil

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

默认配置是以Debug. 所以如果你有一个叫做 的东西Debug Test,它会选择那个。如果它不存在,它会在您的 .sln 文件中按顺序进行。它不会Test Debug接过Debug

回答by JB Brown

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.

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