I have a computer I'm using for development of a VB.NET project which is heavily interfaced with AutoCAD. This computer is running AutoCAD 2009. This program will very soon need to be run on a computer which is running AutoCAD 2013. Will the be any issues with this or will I need to install my VB 2010 Express on the 2013 machine and build the program again using the COM references to AC 2013 in lieu of 2009?
Here is an old article from our knowledge base on this:
How to keep .NET COM Interop DLL compatible between a series of AutoCAD versions?
I have developed several applications that take advantage of the COM API from VB.NET to access named selection sets for AutoCAD 2008. And they worked just fine for my users until I installed AutoCAD 2009 on my development machine. Then when I recompiled those applications that referenced the COM object, the programs are now looking for a 2009 reference, which my clients do not have.
How do I build applications for a 2008 environment after I install 2009? I thought they were binary compatible?
The COM Interop DLL is registered via the registry using the Public Key Token eed84259d7cbf30b and the specific version of this Interop DLL will relate to the newest version of AutoCAD that you have installed. For AutoCAD 2009 it is 126.96.36.199, for AutoCAD 2008 it is 188.8.131.52.
If you reference the COM Interop DLL's then this Public Key Token is referred to and the specific version is imported, there is nothing you can do to specify the version at this point other than to modify the registry by hand, which we don't advise.
As you have found, compiling against the 184.108.40.206 version gives problems on a raw 2008 system.
Now, it appears that the system only contains the 220.127.116.11 version but actually if you take a look in the Windows\Assembly folder you will see that we install all the versions of the Interop DLL's, its just that the main COM entry in the registry only refers to the newest.
The last thing to know is that those COM Interop DLL's are merely .NET assemblies
To compile your COM Interop DLL against a specific version (preferably the lowest of the series (say 2007)), Add A Reference, go to the specific ObjectARX/inc of the version you want, pick both Interop DLL's and you are then done. In other words, don't include them via the Add Reference->COM tab.
Thanks very much for your reply. I'm not sure I fully grasp this. So let me explain what I do understand and let's see if it's what you're suggesting.
On the machine at my desk which is running 2009, I build my program and I have added the COM references:
AutoCAD 2009 Type Library
AutoCAD/ObjectDBX Common 17.0 Type Library
I can build and run this application on this machine just fine. So when I compile it, I should be able to take the .exe file, copy it to the network drives, which I can then access from the other machine running 2013. Then on the computer with 2013 I should be able to successfully run the program?
I have been moved over to the ACAD 2013 machine for expediency. So on that machine I installed VB 2010 Express and started from the beginning again. So as I start writing, or copying and pasting the same code which worked fine on my other desktop running AutoCAD 2009, I added these references:
AutoCAD 2013 Type Library
AutoCAD/ObjectDBX Common 19.0 Type Library
The trouble is that now I cannot add the namespace lines:
Imports Autodesk.AutoCAD.Interop.AcadDocumentClass Imports Autodesk.AutoCAD.Interop.Common
They are not available and of course the code I wrote yesterday on the 2009 system which worked so well is useless without these. I'm still very new to a lot of this so some kindly advice would be appreciated.
Okay, I seem to have found it. The syntax for the namespaces has changed substantially. I wonder if the folks who do the development from one release to the next had to do my job. They may stop making so many changes to the syntax. This is like trying to hit a moving target.
Access a broad range of knowledge to help get the most out of your products and services.