x64 an x86 interop in .NET

.NET assemblies are just a byte-code which is interpreted on host machine. .NET default behaviour is to run assemblies with highest possible capabilities. On 64-bit machines that means running x64. Unfortunately this causes some interoperability problems with 32-bit componets (for example COM).

There is a simple workaround for that problem. You just have to force 32-bit compilation on your assembly. In order to achieve that, go to project properties build tab and set platform target to x86 or use configuration manager to set the target for whole solution.