visual-studio 防止 Visual Studio 自动创建“混合平台”解决方案配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/207566/
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
Prevent Visual Studio from automatically creating "Mixed Platforms" solution configuration
提问by EMP
How do I prevent Visual Studio 2008 from automatically creating the "Mixed Platforms" and "Any CPU" solution configurations? We have "Win32" and "x64" configurations and a developer needs to choose between them. However, as soon as anyone makes any changes to the solution VS automatically creates "Mixed Platforms" and it seems to be the default configuration. This causes a lot of issues, because it turns out some new projects are not selected in this configuration or the wrong project configuration is selected, etc. I just want to stop it doing that and manage the solution configurations myself.
如何防止 Visual Studio 2008 自动创建“混合平台”和“任何 CPU”解决方案配置?我们有“Win32”和“x64”配置,开发人员需要在它们之间进行选择。但是,只要有人对解决方案进行任何更改,VS 就会自动创建“混合平台”,这似乎是默认配置。这会导致很多问题,因为结果发现此配置中未选择一些新项目或选择了错误的项目配置等。我只想停止这样做并自己管理解决方案配置。
回答by Tim Lesher
We see a similar issue with Visual Studio 2005 projects that we want to build both for a Win32 configuration and for a number of distinct smart device platform/configuration combinations.
我们发现 Visual Studio 2005 项目存在类似问题,我们希望为 Win32 配置和许多不同的智能设备平台/配置组合构建这些项目。
At arbitrary times, every configuration gets auto-generated for every platform, whether it's valid or not, exploding the size of each of our ~50 project files and causing a lot of work to fix the issue.
在任意时间,每个平台的每个配置都会自动生成,无论它是否有效,这会导致我们大约 50 个项目文件中的每个文件的大小爆炸,并导致大量工作来解决问题。
It consistently happens when we open the Configuration Manager dialog, and it sometimes (but not always) happens when changing a project setting for a configuration. In the latter case, it seems to be related to manipulating the platform and configuration drop-downs on the project setting dialog.
当我们打开“配置管理器”对话框时总是会发生这种情况,有时(但并非总是)在更改配置的项目设置时会发生这种情况。在后一种情况下,它似乎与在项目设置对话框中操作平台和配置下拉菜单有关。
We filed it as a Visual Studio issue; MSFT closed it as "won't fix".
我们将其作为 Visual Studio 问题提交;MSFT 将其关闭为“无法修复”。
回答by aggieNick02
I've been dealing with the same sort of problem. I agree it is a mess. I've seen two viable options for dealing with it - neither are really what you want.
我一直在处理同样的问题。我同意这是一团糟。我已经看到了两种可行的方法来处理它——它们都不是你真正想要的。
- Manually remove the configurations that it creates by going to the configuration chooser and picking edit...
- By default (at least if I start with a fresh solution in VS 2010) and start creating new projects (both class libraries and apps), you end up with Any CPU, Mixed Platforms, and x86 for your Solution Platforms. Visual Studio seems to do a good job adding new class libraries to both Any CPU and Mixed Platforms (since they default build for the Any CPU target) and adding new apps to both Mixed Platforms and x86 (since the default build for the x86 target), and putting both new class libraries and new apps to Mixed Platforms. So Mixed Platforms ends up being a nice default since it builds everything. I'm not sure why it's not adding new projects for you to Mixed Platforms
- 通过转到配置选择器并选择编辑来手动删除它创建的配置...
- 默认情况下(至少如果我从 VS 2010 中的新解决方案开始)并开始创建新项目(类库和应用程序),最终您的解决方案平台将使用任何 CPU、混合平台和 x86。Visual Studio 似乎在向 Any CPU 和混合平台添加新类库方面做得很好(因为它们默认为 Any CPU 目标构建)并向混合平台和 x86 添加新应用程序(因为 x86 目标的默认构建) ,并将新类库和新应用程序放入混合平台。所以混合平台最终成为一个很好的默认设置,因为它构建了一切。我不知道为什么它没有为您添加新项目到混合平台
回答by frast
You could filter your .sln files in a commit hook of your source control. So that if you check it in the .sln file and possibly the project files get fixed. The open source Chromium project has such a filter implemented.
您可以在源代码管理的提交挂钩中过滤 .sln 文件。因此,如果您在 .sln 文件中检查它,则项目文件可能会得到修复。开源 Chromium 项目实现了这样的过滤器。

