.NET

Reply
Active Contributor
dhorger
Posts: 46
Registered: ‎06-18-2003
Message 1 of 21 (3,836 Views)

2011 Type Libraries Breaks 2010

3836 Views, 20 Replies
05-06-2010 09:56 AM
Hi folks,

I recently installed AutoCAD 2011 for testing purposes, and compiled my .dll (with Visual Studio 2005) with 2011 set as the debug external program. However, now my compiled .dll doesn't work with AutoCAD 2010 and I can't seem to set my Type Library and Autodesk.AutoCAD.Interop.Common references back to 2010 versions, since it looks like they were overwritten in the C:\Program Files\Common Files\Autodesk Shared folder. The error message that pops up on 2010 computers is as follows:

Could not load file or assembly 'Autodesk.AutoCAD.Interop, Version=18.1.0.0, Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.

Is there a way to go back and create dll's for 2010 without uninstalling 2011 or using System Restore?
*Expert Elite*
norman.yuan
Posts: 1,015
Registered: ‎04-27-2009
Message 2 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-06-2010 10:58 AM in reply to: dhorger
Since Acad2006 (maybe Acad2005, which I never installed), the Acad COM primary interop assembly is installed in GAC, where different version of the same assembly can be side-by-side.

For example, in my current computer, in the GAC, I have Autodesk.AutoCAD.Interop assemblies of 16.2.xxx (2006), 17.0.xxx(2007), 17.1.xxx(2008) and 17.2(2009).

So, when you set reference to this interop assembly, you should choose the versioon corresponding to your targeting Acad version. If you want your app work with multiple version of Acad, you'd better choose the oldest version of Interop assembly.

Acad's COM API is pretty good at backward compatibility. For example, my CAD addin apps uses Acad.Interop developed with Acad2006 (referenced to 16.2.xxx), but the apps work as expected with acad2007/8/9, recomplied or not.
Active Contributor
dhorger
Posts: 46
Registered: ‎06-18-2003
Message 3 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-06-2010 11:47 AM in reply to: dhorger
Thanks, Norman. Maybe I'm just an idiot (distinct possibility), but I'm having difficulty with this. When I click on the Add button to add a reference and go to the COM tab, the only option I have for adding Interop is AutoCAD/ObjectDBX 180.0 Type Library, located in C:\Program Files\Common Files\Autodesk Shared\axdb18enu.tlb. Adding that, it indicates that the path is C:\Windows\assembly\GAC_MSIL\Autodesk.AutoCAD.Interop.Common\18.1.0.0__eed84259d7cbf30b\Autodesk.AutoCAD.Interop.Common.dll. If I go to the Browse tab instead of COM when adding, and go to C:\Windows\Assembly I can see I also have a 18.0.0 path available, but I can't select that from that tab.

It seems like it should be easy... any ideas?
*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 4 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-06-2010 11:56 AM in reply to: dhorger
I had a similar issue when I began upgrading my projects from 2009 to 2010, and the solution for my issue was to go to the Project Properties-> Refereneces Tab, select the autocad references you are using, and show the properties window. There is a property there called Specific Version, set it to true.
Dave O.                                                                  Sig-Logos32.png
Active Contributor
dhorger
Posts: 46
Registered: ‎06-18-2003
Message 5 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-06-2010 12:07 PM in reply to: dhorger
I can set both acdbmgd and acmgd to Specific Version, but I don't have that option for the AutoCAD 2011 Type Library and AutoCAD/ObjectDBX Common 18.0 Type Library.
Distinguished Contributor
dnl999
Posts: 129
Registered: ‎10-21-2008
Message 6 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-06-2010 02:23 PM in reply to: dhorger
What I noticed after installing 2011 version (in my case Civil 3D 2011) the tlb type libraries which traditionally appeared on the list with different version numbers in the past did not show up. I had to search and load them from the files. Also, some methods are not available although the 2011 COM api documentation lists them as available 2011 COM methods. I am still struggling to see what is going and any reply from Autodesk would be very much appreiciated.

Andrew,
Active Contributor
dhorger
Posts: 46
Registered: ‎06-18-2003
Message 7 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-06-2010 02:38 PM in reply to: dhorger
That's what I'm seeing, also. Under COM, I've got AutoCAD 2011 Type Library, but no AutoCAD 2010 Type Library, even though I didn't remove 2010 from my system and it's still functional. The dll I create works on my system on both 2010 and 2011 because the 2011 version of Autodesk.AutoCAD.Interop.dll is present and registered, but won't work on systems that don't have 2011 installed.

I'm afraid I might have to uninstall 2011 just so I can modify the dll for 2010 for my users.
*Expert Elite*
norman.yuan
Posts: 1,015
Registered: ‎04-27-2009
Message 8 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-07-2010 07:01 AM in reply to: dhorger
Yes, when you install latest release of the same version of Acad (in your case, Acad 2010, and then Acad 2011, both are Version 18), even previous release' PIA is still in the GAC, but the Windows registry, which makes assembly in GAC shown in VS' "References" dialog box, is updated to only show latest release of the same Acad Version.

The easiest way to solve this is to download Acad ObjectARX SDK, The SDK has a "Inc" (and/or "Inc-win32", inc-x64") folder, in which all the reference DLLs are there for you, in cluding the COM Interop ones (Autodesk.AutoCAD.Interop.dll and Autodesk.AutoCAD.Interop.Common.dll).

You can browse to this folder from Reference dialog box and set reference to the interop dll. When your app runs, .NET always try to load the Interop assembly from GAC first.

Therefore, even your computer has 2010 and 2011 installed, you can still set interop reference to 2010 in the SDK folder, thus, your users who only has Acad 2010 can use your app without issue.
Active Contributor
dhorger
Posts: 46
Registered: ‎06-18-2003
Message 9 of 21 (3,835 Views)

Re: 2011 Type Libraries Breaks 2010

05-07-2010 12:10 PM in reply to: dhorger
Thanks for all your help, Norman. I downloaded the SDK for 2010 and added the acax18enu.tlb and axdb18enu.tlb , but they still point to the AutoCAD 2011 dll's. I'm giving up for now and uninstalling 2011 so I can get back to work.

Thank you everyone for your help!
*Expert Elite*
norman.yuan
Posts: 1,015
Registered: ‎04-27-2009
Message 10 of 21 (3,836 Views)

Re: 2011 Type Libraries Breaks 2010

05-07-2010 12:44 PM in reply to: dhorger
I do not understand why it is still pointing to Acad2011, if you set reference to the Acad.Interop.dll in Acad2010 SDK.

I did a quick test:

1. Start a new VS2008 class library project;
2, Open "add refernce..." dialog box;
3. use "Browse" tab to navigate to targeting ObjectARX SDK saved in the HD (See pic 1);
4. Set reference to AutoCAD.Interop.dll in Acad2010 SDK. the property window show correct version of the assembly is references (18.0.0.0); See pic.2.
5. Remove reference to AutoCAD.Interop.dll from 2010. do the same to AutoCAD.Interop.dll from Acad2011. The property window show the refernced assembly is version 18.1.0.0 (Acad2011).

See the picture attached.

Are you sure you downloaded in Acad2010, not Acad2011? When I went to Autodesk's ObjectARX SDK download site for Acad2011, it offers 3 versions of download (Acad2011/2010/2009). But my Acad 2010 SDK was downloaded last year.

Hint: according to the files I downloaded, the size of Autodesk.AutoCAD.Interop.dll is 140KB (2010) and 144KB (2011). Edited by: norman.yuan on May 7, 2010 7:43 PM
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.