.NET

Reply
Active Contributor
konstantinos.sakellaris
Posts: 43
Registered: ‎07-26-2001
Message 1 of 4 (153 Views)

Compiling C# Programs for different AutoCAD Versions ?

153 Views, 3 Replies
11-30-2006 02:41 AM
Hi,
I am considering to compile diverse C# .NET programs / modules for different versions of AutoCAD, namely 2006 and 2007 .

1.
What is the best way to do it in Visual Studio .NEt 2005,
without having to switch the Project References acdbmgd.dll and acmgd.dll for the different AutoCAD versions and verticals ?

2.
How can I configure the naming sheme ?
For example :

AutoCAD 2006 DLLs compile to :

Module1_2006.dll
Module2_2006.dll........

AutoCAD 2007 DLLs compile to :

Module1_2007.dll
Module2_2007.dll........

I know
It's rather VS 2005 and not .NET API Know-How but there are so many AutoCAD .NET gurus out there...!!!

One could propably help ?????

Thanks in advance
Konstantin
Active Member
shambles
Posts: 6
Registered: ‎02-23-2006
Message 2 of 4 (153 Views)

Re: Compiling C# Programs for different AutoCAD Versions ?

12-08-2006 10:05 AM in reply to: konstantinos.sakellaris
Konstantin

There are a couple of ways to handle this:

1. Use the tlbimp tool run against the AutoCAD type libraries to create your own interop assemblies and reference the generated assemblies from you app.

2. Use assembly re-directs either in the application configuration file or through the .Net Configuration console i.e. always compile against 2006 assemblies and use a re-direct when the app is deployed on a 2007 system.

I'm not sure how this pans out for 2006/2007, but we support 2004 - 2006 using the first method.

cheers
merv
Distinguished Contributor
cgay
Posts: 125
Registered: ‎08-02-2005
Message 3 of 4 (153 Views)

Re: Compiling C# Programs for different AutoCAD Versions ?

12-08-2006 11:32 AM in reply to: konstantinos.sakellaris
merv,

Your #1 approach is what I would recommend, but I couldn't figure out how it would work.

Let's say you use tlbimp to generate an interop assembly for 2006 and 2007.
I would assume you would give each a unique namespace. i.e. AutoDesk.AutoCAD.2006 and AutoDesk.AutoCAD.2007
If this were the case, how would you declare an object of a specific type (say AcadApplication) and expect this to compile?
AutoDesk.AutoCAD.2006.Interop.AcadApplication AcadApp;
AutoDesk.AutoCAD.2007.Interop.AcadApplication AcadApp;

They share no inheritance. How do you do it without writing separate functions for each specific version of AutoCAD?

C
Active Member
shambles
Posts: 6
Registered: ‎02-23-2006
Message 4 of 4 (153 Views)

Re: Compiling C# Programs for different AutoCAD Versions ?

12-11-2006 01:13 AM in reply to: konstantinos.sakellaris
You only create an interop assembly using the 2006 typelibs - this means you cannot use new API features of 2007, but that's probably not going to be a big issue if you are supporting multiple versions. Like I say, I'm not sure how this pans out for 2006/2007, I'm assuming there have been no major changes to the typelibs. We have taken this approach using an interop assembly created against 2004 and it works for 2005 & 2006.
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.