I do the following as mentioned in the above post to try get past the casting problem:
One thing to mention - I found that the calling application was not able to to cast the returned System.__COMObject to LoadableComponent.INumberAddition unless I updated the project settings to "Register from COM Interop" (near the bottom of the Build tab).
As well when I try to build the following error comes up the first time, but not again until I "clean" the project in VS2010:
Error 1 Cannot register assembly "C:\Users\User\documents\visual studio 2010\Projects\SimpleBasicTest\SimpleBasicTest\bin\Release\LoadableComponent.dll". Could not load file or assembly 'Acmgd, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. LoadableComponent
When I check the version in the ObjectARX 2012\INC\ folder for acmgd.dll it is22.214.171.124.0
Where is this elusive 126.96.36.199 version hiding? I do not have any references to the managed DLL's in my stand alone project, I only have a reference to the AutoCAD Type Library from the COM tab in the add reference dialog.
I am guessing my casting problem is from it not being able to find acmgd and hence not registering the assembly for COM interop? Ok fine but how do I shove Visual Studio's face into this DLL? I tried adding it to the project, adding to the folders where the build is, adding it as a reference, basically anything I could think of. And why is it insisting on a version that does not even exist?
Did you set the output directory to the one where the acmgd.dll is? It seems that it's a necesary step in order to resolve de dependency on acmgd.cll. This is almost a copy from a comment in the Kean's Blog.
When I set the output directory to the AutoCAD folder I get:
Error 1 The assembly "C:\Program Files\Autodesk\Acade 2012\LoadableComponent.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'LoadableComponent.Commands, LoadableComponent'. Error: Element not found. LoadableComponent