longzu / csexwb2

Automatically exported from code.google.com/p/csexwb2
0 stars 0 forks source link

csEXWB demo project doesn't build/run on x64 systems (Includes Fix Info) #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
My Environment:
---------------
Windows Server 2008 Enterprise Edition x64 (64-bit)
Dual (2x) Intel Xeon E5410 Quad Core @ 2.33 GHZ (8-core total)
8GB RAM
Running under an account with administrative permissions
UAC enabled, with tweaks

Problem:
--------
When importing/running the "csExWB.sln" solution file (from
http://csexwb2.googlecode.com/files/csExWBv2.0_Includes_ComUtilities.zip)
into Visual Studio 2008 and trying to start the "DemoApp" project I receive
the following message box:

****************************************************************
Error while trying to run project: Unable to start program
'C:\Users\xxx\Desktop\csExWBv2.0_Includes_ComUtilities\csExWB\DemoApp\bin\Debug\
DemoApp.exe'.

The debugger does not support debugging managed and native code at the same
time on this platform.
****************************************************************

Reason:
-------
.NET 2.0 projects, by default, are set to target both the x86 (32-bit) and
x64 (64-bit) platforms. So an application runs as a 64-bit application when
launched on a x64 operating system, and as 32-bit application when launched
on 32-bit operating system.

64-bit applications can't link/use 32-bit libraries (.dll).

DemoApp runs as a 64-bit application on my system, and because it tries to
link to a 32-bit dependency, it fails.

Solution:
---------
1.) Go to Visual Studio 2008 (probably similar in 2005)
2.) In "Solution Explorer" right click on the "DemoApp" project.
3.) Choose the "Properties" menu item
4.) Select the "Build" tab (left side)
5.) In the "General" section set the "Platform target:" to "x86".
6.) Save and clean/rebuild/redeploy.

Temporary Client Solution:
--------------------------
To get applications that were built by others, that use csExWB, that did
not perform the above procedure. You can modify the PE header of the
executable (using the "Corflags.exe" .NET Framework SDK utility) to force
the executable to run in x86 mode on the x64 platform. 

Information on "Corflags.exe" can be found here:
http://www.request-response.com/blog/PermaLink,guid,cf345d71-cdc7-46b9-8c1c-eb21
581a9222.aspx

The procedure is to:

1.) Go to the Start Menu, and Navigate to the "Microsoft Visual Studio
2008" folder, expand it and under the "Visual Studio Tools" folder, ran the
"Visual Studio 2008 Command Prompt".
2.) In the command prompt, navigate to the folder where executable is located.
3.) Run the command "corflags /32BIT+ EXEName.exe"
4.) Run "corflags EXEName.exe" to verify that the "32BIT" flag was set to "1".
5.) You're done! You can now run the application properly.

Original issue reported on code.google.com by joseph.g...@gmail.com on 30 May 2008 at 3:13

GoogleCodeExporter commented 8 years ago
Thank you for the detailed explanation and solution.

Regards,

MH

Original comment by mehr...@gmail.com on 30 May 2008 at 7:45

GoogleCodeExporter commented 8 years ago
Thank you for your detailed explanation. we have spend more than a week to find 
this solution. Now my application is working fine.

Great Work!!!
Thank you!

Original comment by anishanmugam@gmail.com on 8 Oct 2010 at 1:24

GoogleCodeExporter commented 8 years ago
yeah! Thanks for the solution. 

Original comment by Pawlowsk...@gmail.com on 12 Jan 2011 at 9:48