防止 VisualStudio 自动创建“混合平台”解决方案配置

如何防止 VisualStudio2008自动创建“混合平台”和“任意 CPU”解决方案配置?我们有“ Win32”和“ x64”配置,开发人员需要在它们之间做出选择。但是,一旦有人对解决方案进行任何更改,VS 就会自动创建“混合平台”,而且它似乎是默认配置。这会导致很多问题,因为在这个配置中没有选择一些新项目,或者选择了错误的项目配置,等等。我只是想停止这样做,并自己管理解决方案配置。

11217 次浏览

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.

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.

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

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.

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.

  1. Manually remove the configurations that it creates by going to the configuration chooser and picking edit...
  2. 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