无法将目标平台更改为“任意 CPU”

我在一台 x86电脑上工作并使用。VS2010中的 NET4.0(与3.5相同的问题)。当我制作一个新的项目(例如 WinFormsApp)时,我想做的第一件事就是将项目/解决方案的目标平台更改为“任意 CPU”。

我做以下事情:

Project Properties-> build-> change TargetPlatform to“ Any CPU”

在属性页面的顶部,平台仍然是“ Active (x86)”,所以我这样做了

解决方案属性-> ConfigurationsMgr-> Platform-> new (因为只有 x86可用)并创建解决方案平台“ AnyCPU”。

现在项目属性是“ Active (AnyCPU)”,我可以根据自己的喜好来回更改它。

现在的问题是: 当我添加一个新的项目,它再次被设置为“活动(x86)”,我-再次-不能更改项目设置。在第二个项目的 SolutionProperties-> ConfigurationManager 中,“ AnyCPU”平台不可用,我不能添加一个新的,因为它告诉我 AnyCPU 的解决方案平台已经存在..。

我做错了什么? 将一个新创建的项目设置为 AnyCPU 有那么难吗?

85030 次浏览

In the configuration Manager, you can add a new platform for your project. However, you need to uncheck the "Create new solution platforms" if you already added the platform for your solution, otherwise you will indeed get the warning that the solution platform is already there.

To change target platform do the following:

[1.] Open the configuration manager

enter image description here

[2.] In platforms, select new.

enter image description here

[3.] New platform select x64 or you need, in "copy settings from" select "Any CPU" or "Empty", and uncheck the "Create new solution platforms"

enter image description here

source: ericklan.com

You can proceed as follow to configure the target platform:

  1. In Visual Studio, right click on the solutionSelect "Properties"
  2. A setting dialog will appear
  3. Click on configuration Settings: You will see all the projects of the solution and the configation of the compilation.
  4. Click on "Configuration Manager" button (top right of the dialog)
  5. You will see two dropdowns, click on the "Target Platform" one and then on "New" in order to add the the desired target platforms
  6. Once the desired target platforms added, choose the one that you want
  7. Click close then Ok