开发者

Forcing a C# 64bit application to run as 32bit?

开发者 https://www.devze.com 2022-12-20 06:44 出处:网络
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 applic开发者_开发问

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 applic开发者_开发问答ation 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)


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/


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消