The managed API is starting to get on my last nerve

Discussion in 'AutoCAD' started by Frank Oquendo, Sep 10, 2004.

  1. Here's another problem:

    I reference acax16.enu.tlb in the Autodesk Shared folder.

    In Visual Studio, I get a reference named AutoCAD and points to the
    assembly Autodesk.AutoCAD.Interop.dll which is registered in the GAC.

    For some reason, even though the type library contains definitions for
    interfaces such as IAcadDatabase, the GAC-registered assembly does not.

    So Visual Studio directs me to reference the assembly
    Autodesk.AutoCAD.Interop.Common.dll.

    This appears to be another name for axdb16enu.tlb (same location as
    acax16enu.tlb).

    I browse to it, select it as a reference and I get an assembly named
    Interop.AXDBLib.dll which defines the AXDBLib namespace.

    Naturally, Visual Studio says I'm still not referencing the correct library.

    So I remove that reference and use TLBIMP to create an assembly which
    defines the correct namespace only to have TLBIMP warn me that a primary
    interop assembly for this namespace is already registered in the GAC.

    So on to the questions:

    1) Why does the primary interop assembly for AutoCAD require a reference
    to another interop assembly when acax16enu.tlb defines all the
    necessary interfaces for COM interop?

    2) Why does referencing axdb16enu.tlb not result in a reference to
    Interop.Common primary interop assembly?

    3) Why do neither of the primary interop assemblies show in the
    References dialog?

    4) How do I reference Autodesk.AutoCAD.Interop.Common in my project?
     
    Frank Oquendo, Sep 10, 2004
    #1
  2. See below:

    [ALBERT:] This is for identity reasons. The AutoCAD COM API is implemented
    by acad.exe and axdb16.dll and acax16enu.tlb actually duplicates some of the
    co-classes and interfaces in axdb16enu.tlb. This is OK as far as COM is
    concerned but .NET has stricter type identity rules. We can't have the same
    coclasses and interfaces in 2 different assemblies because they will be
    treated as completely different types.
    [ALBERT:] I can't reproduce this problem. If I reference axdb16enu.tlb I get
    a reference to Autodesk.AutoCAD.Interop.Common.dll in the GAC. I suspect
    that the registry entries for axdb16enu.tlb are somehow corrupted and that's
    why this doesn't work for you. Try repairing the registry using the AutoCAD
    installer.
    [ALBERT:] They show up under the COM tab as a typelib. I believe that is
    consistent with PIAs from other vendors.
    [ALBERT:] You reference axdb16enu.tlb and you should automatically get a
    reference to Autodesk.AutoCAD.Interop.Common.dll in the GAC.
     
    Albert Szilvasy \(Autodesk\), Sep 13, 2004
    #2
  3. Frank Oquendo

    Sheana Guest

    I am having the same problem. Did you ever get yours to work? If so, what did you do?
     
    Sheana, Jan 17, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.