• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Distinguished Contributor
    Posts: 311
    Registered: ‎07-29-2004

    Build for multiple Autocad versions

    181 Views, 16 Replies
    05-18-2005 01:38 PM
    The interop assembly being provided by Autodesk and going through activex interfaces creates a unique problem.

    I can only build for one version at a time, if I have 2006 installed and write a .net app for Autocad, it will not run on a system with only 2005 installed.

    To solve this and be able to build for both 2005 and 2006, I had to build a batch file that unregisters the 2006 interop and registers the 2005 one (boring).

    Not a major issue, but it adds an extra complicated step that dot net is supposed to eliminate.
    Please use plain text.
    *Frank Oquendo

    Re: Build for multiple Autocad versions

    05-18-2005 04:04 PM in reply to: ChrisArps
    CArps wrote:

    > Not a major issue, but it adds an extra complicated step that dot net
    > is supposed to eliminate.

    If you're willing to accept the performance penalty, it's possible to use
    late binding thus freeing you from the problem.

    I wouldn't recommend it for intense purposes but it's a great solution for
    querying drawings.
    Please use plain text.
    *Albert Szilvasy

    Re: Build for multiple Autocad versions

    05-18-2005 07:08 PM in reply to: ChrisArps
    Another thing you can do is use binding redirect in acad.exe.config.
    1. Build against the R2005 version of the interop assemblies.
    2. Add the following to acad.exe.config on R2006. I haven't tried this so I
    may have some silly typos. It shows the idea nonetheless:




    publicKeyToken="eed84259d7cbf30b" culture="neutral" />




    publicKeyToken="eed84259d7cbf30b" culture="neutral" />







    wrote in message news:4849652@discussion.autodesk.com...
    The interop assembly being provided by Autodesk and going through activex
    interfaces creates a unique problem.

    I can only build for one version at a time, if I have 2006 installed and
    write a .net app for Autocad, it will not run on a system with only 2005
    installed.

    To solve this and be able to build for both 2005 and 2006, I had to build a
    batch file that unregisters the 2006 interop and registers the 2005 one
    (boring).

    Not a major issue, but it adds an extra complicated step that dot net is
    supposed to eliminate.
    Please use plain text.
    *Albert Szilvasy

    Re: Build for multiple Autocad versions

    05-18-2005 07:12 PM in reply to: ChrisArps
    And yet another solution is to use your own interop assembly (based on say
    the R2004 version of the typelib). You don't have to use the PIA. Using your
    own interop assembly will make you redistributable bigger but it will work
    for R2004, 2005, 2006.

    Albert

    wrote in message news:4849652@discussion.autodesk.com...
    The interop assembly being provided by Autodesk and going through activex
    interfaces creates a unique problem.

    I can only build for one version at a time, if I have 2006 installed and
    write a .net app for Autocad, it will not run on a system with only 2005
    installed.

    To solve this and be able to build for both 2005 and 2006, I had to build a
    batch file that unregisters the 2006 interop and registers the 2005 one
    (boring).

    Not a major issue, but it adds an extra complicated step that dot net is
    supposed to eliminate.
    Please use plain text.
    Distinguished Contributor
    Posts: 311
    Registered: ‎07-29-2004

    Re: Build for multiple Autocad versions

    05-19-2005 05:24 AM in reply to: ChrisArps
    That could break other applications or introduce old framework bugs into R2006 itself. I have to remain interoperable with other plugins for ADT.
    Please use plain text.
    *Laurence Skoropinski

    Re: Build for multiple Autocad versions

    05-19-2005 05:26 AM in reply to: ChrisArps
    I also have this problem, and I like the idea of a batch file fix, are you
    willing to post the text contained in your batch file please....

    Laurence
    wrote in message news:4849652@discussion.autodesk.com...
    The interop assembly being provided by Autodesk and going through activex
    interfaces creates a unique problem.

    I can only build for one version at a time, if I have 2006 installed and
    write a .net app for Autocad, it will not run on a system with only 2005
    installed.

    To solve this and be able to build for both 2005 and 2006, I had to build a
    batch file that unregisters the 2006 interop and registers the 2005 one
    (boring).

    Not a major issue, but it adds an extra complicated step that dot net is
    supposed to eliminate.
    Please use plain text.
    *Albert Szilvasy

    Re: Build for multiple Autocad versions

    05-19-2005 09:57 AM in reply to: ChrisArps
    Yep. This may break other R2006 based apps that rely on R2006-only features.

    Albert

    wrote in message news:4850121@discussion.autodesk.com...
    That could break other applications or introduce old framework bugs into
    R2006 itself. I have to remain interoperable with other plugins for ADT.
    Please use plain text.
    Distinguished Contributor
    Posts: 311
    Registered: ‎07-29-2004

    Re: Build for multiple Autocad versions

    05-19-2005 01:47 PM in reply to: ChrisArps
    That will not work as you can only have one primary interop assembly linked to an activex typelib.

    Since the version of the typelib has not changed, there is no way to accomplish this without unregistering the PIA on the end users machine.

    Plus you will lose some of the .net only objects that are in Autodesks PIA.

    The solution is for Autodesk to provide a real dot net dll and get rid of activex. As long as the registry is involved, you will have to deal with "dll hell".
    Please use plain text.
    *Frank Oquendo

    Re: Build for multiple Autocad versions

    05-19-2005 01:52 PM in reply to: ChrisArps
    CArps wrote:
    > That will not work as you can only have one primary interop assembly
    > linked to an activex typelib.

    As he said: you are not forced to use the PIA. Simply create a local
    assembly using TLBIMP. As long as you specify the namespace to be
    contained by your assembly, it'll work just fine.
    Please use plain text.
    Distinguished Contributor
    Posts: 311
    Registered: ‎07-29-2004

    Re: Build for multiple Autocad versions

    05-19-2005 02:03 PM in reply to: ChrisArps
    Sure, the first two steps you will have to do manually to setup for your compiles/builds.

    1) Locate the Autodesk .dll files in the GAC. You cannot use windows explorer for this, you have to use the good old command line with cd and dir.

    CD \winnt\assembly\GAC
    xcopy *.* c:\temp\junk /S

    This will copy all the subdirs and all dlls in the gac so you can get at them with explorer.

    2) Find the appropriate Autodesk folders and copy the dlls to a nice location for your builds for ease of use.You will need a folder for each version.

    Now that we have the dotnet dlls you can now setup for builds.

    Assuming we are building the 2006 version of the program:

    3) Execute the unregister batch file for 2005 (shown below)
    cd Assembly
    cd ADT45
    %Framework%\regasm Autodesk.AEC.Interop.ArchBase.dll /u
    %Framework%\regasm Autodesk.AEC.Interop.Base.dll /u
    %Framework%\regasm Autodesk.AEC.Interop.UIArchBase.dll /u
    %Framework%\regasm Autodesk.AEC.Interop.UIBase.dll /u
    %Framework%\regasm Autodesk.AutoCAD.Interop.dll /u
    %Framework%\regasm Autodesk.AutoCAD.Interop.Common.dll /u
    cd ..
    cd ..

    if (%1)==(AUTO) goto :EOF
    pause

    4) Execute the register batch file for 2006 (shown below)
    cd Assembly
    cd ADT47
    %Framework%\regasm Autodesk.AEC.Interop.ArchBase.dll
    %Framework%\regasm Autodesk.AEC.Interop.Base.dll
    %Framework%\regasm Autodesk.AEC.Interop.UIArchBase.dll
    %Framework%\regasm Autodesk.AEC.Interop.UIBase.dll
    %Framework%\regasm Autodesk.AutoCAD.Interop.dll
    %Framework%\regasm Autodesk.AutoCAD.Interop.Common.dll
    cd ..
    cd ..

    if (%1)==(AUTO) goto :EOF
    pause

    There are 4 batch files, reg and unreg for 2005, reg and unreg for 2006. Thist allows a developer to be on 2006 and we can build for both versions (as long as he doesn't use any 2006 only features).
    Please use plain text.