无法在Visual Studio 2010中选择Platform x64 [英] Can't select Platform x64 in Visual Studio 2010

查看:454
本文介绍了无法在Visual Studio 2010中选择Platform x64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的解决方案中,我正在导入用作参考的外部项目。编码并设置了Release x64(在标准工具箱中)后,我遇到了构建问题。该问题肯定与x64 / x86配置有关。当我也转到解决方案和项目的属性时,除了我的项目外,所有其他属性都设置为x64。最后,问题是我不能选择x64。有没有人遇到过这种问题?错误消息是:

In my solution I am importing external projects which I use as references. After coding and setting Release x64 (in Standard toolbox) I got a problem with build. The problem is for sure related to x64/x86 configuration. When I go to properties of the solution and projects as well, all of them are set to x64 except my project. Finally, the problem is that I can't choose x64. Has anyone faced with this kind of problem? The error message is:


无法加载文件或程序集…试图加载格式错误的
程序(System.BadImageFormatException)

Could not load file or assembly … An attempt was made to load a program with an incorrect format (System.BadImageFormatException)

预览也在这里...

推荐答案

Microsoft启动时,解决方案平台选项变得一团糟修改VS2010中C#项目的默认选择。它始终是AnyCPU,可准确反映托管项目在任何处理器上运行的能力。在VS2010中,他们将默认值更改为x86。这就产生了大量问题,他们在VS2012及更高版本中切换回AnyCPU。

The solution platform option turned into a huge mess when Microsoft started tinkering with the default selection for C# projects in VS2010. It always used to be AnyCPU, accurately reflecting the ability of managed projects to run on any processor. In VS2010 they changed the default to x86. That created massive amounts of problems, they switched back to AnyCPU in VS2012 and up.

最好的方法是单击Configuration Manager按钮并删除所有多余的平台。您现在还停留在VS2010上,因此仅保留x86,因为这是新项目的默认设置。在任何其他VS版本上,请保留AnyCPU。只需记住一个名称是无关紧要的。

The best thing to do is to click the Configuration Manager button and delete all of the extraneous platforms. You are stuck on VS2010 right now so only keep x86 since that is the default for new projects. On any other VS version keep AnyCPU. Just keep a mental note that the name is irrelevant.

进程的实际位数由EXE项目确定,它是启动进程并可以强制执行的过程。 CLR使用特定的抖动。右键单击项目>属性>构建选项卡>平台目标设置。如果您需要程序在32位模式下运行,请选择x86。否则,请使用AnyCPU。您的所有库项目都应为AnyCPU,以便它们可以简单地遵循EXE项目或单元测试的选择。

The actual bitness of the process is determined by the EXE project, it is the one that starts the process and can force the CLR to use a particular jitter. Right-click the project > Properties > Build tab > Platform target setting. Pick x86 if you need your program to run in 32-bit mode. Otherwise use AnyCPU. All of your library projects should be AnyCPU so they can simply follow the EXE project or unit test selection. Do this both for the Debug and Release configurations.

首先,当您开始在VS2015中创建通用应用程序时,这很重要。不再烦恼,然后您需要测试应用程序的.NET Native编译版本,它会关注解决方案平台。因此,对于此类项目,再次重要的是,您需要保持x86,x64和ARM平台不变。与VS2010问题无关。

Fwiw, it does matter whenever you start to create Universal apps in VS2015. No longer jitted, you then need to test the .NET Native compiled version of your app, it pays attention to the solution platform. So for those kind of projects it is important again, you need to keep the x86, x64 and ARM platforms around. Not relevant to this VS2010 question.

这篇关于无法在Visual Studio 2010中选择Platform x64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆