Question

I don't see any other value other than 'Any CPU' in the drop down list in Properties -> Build -> Configuration -> Platform in Visual C# 2010 Express or in Visual Web Developer 2010 Express.

I just removed some 64-bit dlls and got their 32-bit versions and added a reference to them.

Since then, I've been receiving a BadImageFormatException.

Was it helpful?

Solution 2

I found a couple of suggestions elsewhere but they haven't worked for me so far.

I found this one to be the most useful of all.

http://social.msdn.microsoft.com/Forums/en-US/d4fa83dc-eed1-4ead-96a1-78bbd9ba6d3a/vb-express-target-x86-platform?forum=vblanguage

For anyone who faces this same problem later, here's help. It says:

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.

OTHER TIPS

Is it the platform or the platform target?

If you want to add a new platform then do this:

Open the Configuration manager for your solution.

Expand the Platform combo for the project. It will show several items: Any CPU, and .

Press This will open a new dialog to add a new target for your solution. Select x64 for the new platform and Any CPU as the target from where to copy the settings. You can also check the "Create new solution platforms" if you want to add a solution target also.

Then, if you go to the project properties you can select this platform.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top