visual-studiovisual-c#-express-2010visual-web-developer-2010

How do I change the target platform in a console app in Visual C# 2010 Express or Visual Web Developer 2010 Express?


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.


Solution

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