By Adam Nagy
I have an AutoCAD .NET AddIn which provides an ActiveX server that allows me to drive my AddIn from an external application. This works fine on a 32 bit OS, but on 64 bit I get a "Problem in loading application" error when using GetInterfaceObject() to access my ActiveX server. I checked and the AddIn is loaded, so I'm not sure what goes wrong.
Solution
When you are building your application on a 64 bit OS, then the ActiveX server inside your AddIn is registered by Visual Studio in the 32 bit hive of the registry since Visual Studio itself is 32 bit even on a 64 bit OS. So you have to register your component yourself using the 64 bit version of regasm.
The easiest solution is if you just add a Build Event to your project which runs after each successful build of your project:
"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\regasm.exe" "$(TargetPath)" /tlb /codebase