views:

24

answers:

1

I'm currently porting a project of mine from x86 to x64. It is a plugin and absolutely must run as an x64, since the host does too.

Part of the application creates a dynamic assembly:

AppDomain.CurrentDomain.DefineDynamicAssembly(...)

And then saves that to the disk. I checked it with dumpbin /headers, its in x86!

How can I force the assembly to be x64 from code?

+2  A: 

This is entirely normal, assemblies that contain IL code always are packaged in a DLL that has a 32-bit header. Same thing you get with Project + Properties, Build tab, Platform Target = Any CPU.

Keep in mind: pure .NET assemblies only contain data, no code. Whether the JIT compiler translates the IL to 32-bit or to 64-bit code is determined by the bitness of the startup EXE.

Hans Passant
Problem is, the host won't run the plugins. Even worse: I get no error message either. That is why I'm suspecting the host is having difficulties dynamically loading the assembly. The host is a native application, offering .NET extensibility features.
Daren Thomas
Excuse me. Just started PC today and everything works. Thanks for shedding some light on the issue!
Daren Thomas