我在Visual C#2010 Express或Visual Web Developer 2010 Express的Properties -> Build -> Configuration -> Platform
下拉列表中看不到除“任何CPU”以外的任何其他值。
我刚删除了一些64位dll并获得了32位版本,并添加了对它们的引用。
从那时起,我一直在收到BadImageFormatException
。
答案 0 :(得分:1)
是平台还是平台目标?
如果您想添加新平台,请执行以下操作:
打开解决方案的配置管理器。
展开项目的平台组合。它将显示几个项目:任何CPU,和。
按此按钮将打开一个新对话框,为您的解决方案添加新目标。为新平台选择x64,选择任何CPU作为目标,从中复制设置。如果您还想添加解决方案目标,也可以选中“创建新的解决方案平台”。
然后,如果您转到项目属性,则可以选择此平台。
答案 1 :(得分:0)
我在其他地方找到了一些建议,但到目前为止他们还没有为我工作。
我发现这个是最有用的。
对于后来遇到同样问题的人,这里有帮助。它说:
Express Editions:
The VB and C# Express products do not expose the
Target property inside the development environment.
You will need to carefully modify the project file
using a text or XML editor.
1. Close the project and/or solution
2. Select Open File from the File menu
3. Navigate to the project directory, and highlight
the project file
4. Press the Open button, the project file should open
in the XML editor
5. Locate the first <PropertyGroup> section and add
the following line:
<PlatformTarget>x86</PlatformTarget>
1. Save the project file
2. Reopen the project and/or solution using
Open Project/Solution from the File menu
3. Continue with development, debugging, and testing
Alternatively, if the application is targeted to 64-bit
platforms, you can ensure that the COM controls added to
the application have 64-bit equivalents on the development
and deployment computers.
JohnWein added the following:
Using the above method targets the x86 platform, but it
doesn't show the "Configuration:" and "Platform: " boxes
on the Properties tabs. To get this feature, I made a
template of one of the projects that shows these boxes.
Now I can target a platform and know what platform I
have targeted.