I need to integrate some legacy 32-bit code - for which I don\'t have the source code, into a project in such a way that it can be called from a 64-bit .NET assembly. The or
Check out this blog post. You can reference a 32 bit COM assembly from a 64 bit .NET application using a runtime callable wrapper. The short version is the following...
Use tlbimp.exe to create a 64 bit Runtime Callable Wrapper:
tlbimp.exe foo.dll /machine:x64 /out:Interop.Foo.dll
Register the COM assembly (not the RCW) if you haven't already:
regsvr32.exe foo.dll
Reference the RCW (eg. Interop.Foo.dll) from your application. Change your Build Configuration to x64 and let 'er rock.