Single x86-built Assembly Causing entire Assembly to execute as 32-bit

My program (a console application) references several other assemblies (many open-source libraries). I built the assembly with the "Any CPU" option set (using VS2008). When I start the assembly from a 64-bit command prompt on a Windows Server 2008 x64 machine the process always starts as a 32-bit process!

I looked through my references and it appears as though I have a reference for a 32-bit assembly referenced. Could this single reference cause the entire assembly to start as 32-bit?

Also, I use ILMerge to merge all of the referenced assemblies into a single assembly. Maybe that has something to do with it?

Could someone help me figure out what is going on here?

Answers


If you need to load a 32bit assembly, the entire process will need to be 32bit. You could target "Any CPU" for your main application, but then it will run 64bit, and fail at runtime when it tries to load the 32bit assembly.

ILMerge is smart enough to switch the main entry assembly from AnyCPU to x86 if you have an x86 assembly as part of your merge, to prevent this from being a problem.

If you want to run 64bit - you'll need to have all of the assemblies be 64bit or AnyCPU.


Yes, this is likely your problem. I would rebuild the assembly as "Any CPU".


Need Your Help

Cassandra: How to SKIP Rows in paging?

cassandra paging nosql

Can we use the paging in Cassandra without using paging state? I mean, what should we do if we want to have random access (jump in) to page 3 after first page, for example?

UIWebView - remove loading indicator, BEFORE images are finished downloading, but AFTER webView is rendered

ios objective-c ios7 uiwebview delegates

I know that one can implement a loading UIView with the usual UIWebView delegate methods webViewDidStartLoad: and webViewDidFinishLoad: