What is a mixed mode assembly?

There is a way to produce a mixed-mode assembly from pure IL. The final part of creating an assembly using reflection involves a call to AssemblyBuilder.Save. If you just pass PortableExecutableKinds.Required32Bit for the portableExecutableKind argument then you will create a mixed-mode assembly. You can avoid the problems this causes by also passing PortableExecutableKinds.ILOnly. i.e.


    assembly_bldr.Save(exe_name, PortableExecutableKinds.Required32Bit | PortableExecutableKinds.ILOnly, ImageFileMachine.I386 );

Needless to say, this information was hard won...


Taken from the official FAQ

(14) What is a mixed-mode assembly?

A mixed-mode assembly is a dynamic link library that contains both managed code and native code for a particular processor architecture. Since it contains native code it can only be loaded into a process that matches the processor architecture it was compiled for. Also see this StackOverflow question.

It even references this question!


http://msdn.microsoft.com/en-us/library/x0w2664k.aspx

1) Allways check msdn first. Mixed mode means that the assembly can run managed and unmanaged code.

2) Setups for 32-bit Windows (.NET Framework 4.0)

http://system.data.sqlite.org/sqlite-netFx40-setup-bundle-x86-2010-1.0.74.0.exe

You kinda answered that question yourself "My project that is going to use this library is all .NET 4 which will be compiled to x86."