Let's say that when i've compiled a managed assembly, i've forced it to be 64 bit (using the configuration manager). and let's say, that after the compilation i want to run that application as a 32bit process. can i force it to be 32bit again?
i tried to play around and edit the PEHeader (the Machine and 32BitOnly fields), but the application won't start on a 32bit platform.
is there a difference in the produced IL when i force the compile it as 64bit? (in comparison to AnyCPU)
0
votes
This begs the question - why? Just curious. What are the gains over Any CPU?
– Preet Sangha
@Preet: Interaction with 32-bit COM components
– SLaks
By "Won't start" I assume you're seeing an error, what error?
– Binary Worrier
@Binary Worrier, "... is not a valid win32 application"
– unknown
2 Answers
2
votes
I recommend using one of the many approaches discussed here: http://lostechies.com/gabrielschenker/2009/10/21/force-net-application-to-run-in-32bit-process-on-64bit-os/
1
votes
I don't believe there is a difference in the IL, the difference in the the non-managed headers. 64 bit mode compiles an EXE with a PE32+ format header (that is 64 bit). So just changing a flag won't change the actual format of the EXE. That's the reason you get the error that it is not a valid 32bit applications, it's not, it's a 64 bit application and 32 bit Window's can't parse the PE32+ header.
You would have to completely rewrite the EXE to PE32 format, so it probably isn't possible.
Can't you just recompile or is this just for your own interest?