.NET

Reply
Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 1 of 7 (522 Views)
Accepted Solution

make one dll run in all autocad versions?

522 Views, 6 Replies
03-08-2014 08:46 AM

i want to make a dll that can run in autocad version from 2004 to 2014,how many projects will be compiled?

Or is there any methods to make only one dll and met all the 2007 to 2014 version?

thanks

swaywood

*Expert Elite*
_gile
Posts: 2,077
Registered: ‎04-29-2006
Message 2 of 7 (490 Views)

Re : make one dll run in all autocad versions?

03-08-2014 02:22 PM in reply to: swaywood

Hi,

 

It seems to me .NET cames in AutoCAD with the 2005 version and got stable and efficient with the AutoCAD 2007 version and the Framework 2 (you can see this table from here).

 

You cannot have a single DLL for A2007 to A2014 because there was a break in binary compatibility for AutoCAD .NET applications with the 2013 version due to the fact acad.exe has been splitted into acad.exe and AcCore.dll (this is the only one real break in AutoCAD .NET compatibility)

You can see this post on Kean's blog.

So, an AutoCAD .NET application needs almost 2 projects (DLLs) to run from A2007 to A 2014 (one from A2007 to A2012 and another one for A 2013 and later).

 

Very few things have been modified in the acad .NET API between A2007 and A2012, but many new features have been added at each new version (samething for the Frameworks)...

So, an AutoCAD .NET application compiled against A2007 SDK and Framework 2 will work until A2012 in most of the cases.

 

Even with the 2013 break, most of codes won't need any modification to work with A2013 and later.

So, most of the time, you can share the same code between several projects in a single solution.

 

In a solution, bulid a project targeting the libraries and the Framework corresponding to the oldest AutoCAD version you want to be compatible.

Try your application with all autoCAD versions from the oldest to 2012, it will probably work.

In the same solution, for A2013 and later,

- create a new project (class library) targeting the Framework 4, add the required references (acmgd.dll, acdbmgd.dll, accoremgd.dll from ObjectARX 2013\inc (prefered) or AutoCAD 2013 installation folder) ;

- Remove the 'Class1' file

- Right clic the 2013 project > Add > Existing element..., browse to the other project, select the .cs or .vb files, choose 'Add as link' in the 'Add' button popup menu.

- Compile

- Test the application

 

Doing this, the code maintenance will be easier: the modification to the code will affect the both projects.

Gilles Chanteau
Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 3 of 7 (480 Views)

Re : make one dll run in all autocad versions?

03-08-2014 09:15 PM in reply to: _gile
Hi,Gile Thanks so much! I found something in a chinse forum. They write a new dll instead of autocad's 3 dlls using a reflect emthod. It's so cool, but the new dll is very difficult to made, the following is the link. http://bbs.mjtd.com/thread-81355-1-1.html
Active Contributor
CADbloke
Posts: 37
Registered: ‎08-12-2008
Message 4 of 7 (413 Views)

Re: make one dll run in all autocad versions?

03-10-2014 02:46 PM in reply to: swaywood

As Gile has said, you need to build different DLLs to cater different binary compatabilities. I do it by hand-editing the csproj file. For more details see http://www.theswamp.org/index.php?topic=41868.msg497509#msg497509

Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 5 of 7 (404 Views)

Re: make one dll run in all autocad versions?

03-10-2014 06:21 PM in reply to: CADbloke
Hi,CADbloke
thank you for your reply.
my old method is the same with '_gile', one set of code several sets of project file which including each autocad version or .net version and the code is added by link.
I read your link, but can not understand totally. could you upload a simple example zip or rar file including a VS solution with ONE project control autocad 2007 version and autocad 2013 version.
Active Contributor
CADbloke
Posts: 37
Registered: ‎08-12-2008
Message 6 of 7 (358 Views)

Re: make one dll run in all autocad versions?

03-12-2014 02:02 AM in reply to: swaywood
I will try to make an example if I can find the time.. IF. The critical thing to remember with my method is that there is only one project, it is the different build configurations that will give you the different versions of the DLLs you need.
Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 7 of 7 (326 Views)

Re: make one dll run in all autocad versions?

03-14-2014 03:47 AM in reply to: CADbloke
you are right, i want to learn from you how to use only one project.
i think it will not take long time, but for me and other programmer, it will save more time.
thanks.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community