.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

do I need to make separate projects for different acad versions

10 REPLIES 10
Reply
Message 1 of 11
JamesMaeding
784 Views, 10 Replies

do I need to make separate projects for different acad versions

My question relates to references.

I know I can choose a particular acmgd.dll for say C3D 2009, with copy local set to false.

What happens when run the project in Map3D 2009 on a computer without C3D?  What are the rules on where it looks for references?

 

Is there a slick way to handle references so I could use one project for multiple acad versions, by controlling some set of search paths like acad does for support paths?

Obviously I have a lot to learn about .net, but these organizational issues do not get talked about much.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

10 REPLIES 10
Message 2 of 11

I had just typed up a reply to this when I lost my internet connection...

 

Short answer is I do not believe so.  It has been a while since my company used any of the AutoCAD verticals (for us that would have been Building Systems or MEP) so hopefully someone else will confirm or deny, but I think the AcMgd.dll and AcDbMgd.dll are identical between the verticals.

 

If that is correct, then you should be able to load your dll into any of the verticals, and you don't need to worry about paths.  For one thing, since you can only access acmgd and acdbmgd from netloaded .dll's, acmgd and acdbmgd are already loaded by the time your .dll is loaded, and your .dll will just use the ones that are loaded, instead of trying to load the ones specified in your project references.

Dave O.                                                                  Sig-Logos32.png
Message 3 of 11
jeff
in reply to: JamesMaeding

By versions I gues you mean Verticals, but each product for the same year uses the same acmgd.dll 

 

AutoCAD will load those references at startup and by not setting copy local to false it causes it to be loaded twice causing problems.

 

 

If you need to load them for something like creating and instance from string then load it using ReflectionOnlyLoad() so it will not cause problems

 

http://www.theswamp.org/index.php?topic=39293.0

 

 

 

You can also find your answers @ TheSwamp
Message 4 of 11

ah, very helpful info on the alreadly loaded refs, did not know that but makes sense.

I guess what i am trying to avoid is setting up two helper function projects for the exact same code, but for two different acad versions.

I am doing it that way now.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 5 of 11
JamesMaeding
in reply to: jeff

no, I mean different versions like 2009 and 2012.

It seems ok to use the same references to acad stuff within a version, but I would like to use a project with references to acad 2009 dlls, in a solution that will be compiled for 2012.  that way I can have generic helper projects for both 2009 and 2012 solutions.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 6 of 11
kob4lt
in reply to: JamesMaeding

If you use methods that are they same as in Acad 2009 or in Acad 2012, you dont have to build separate projects for the same code

Message 7 of 11
jeff
in reply to: kob4lt

A simple explanation might be

 

I can use the 2007 acdbmgd and acmgd and target 2.0 and work fine in 2012, but i can NOT use 2012 acdbmgd and acmgd and target 4.0 then use in 2007.

 

If that makes sense so build it for 2009.

You can also find your answers @ TheSwamp
Message 8 of 11
Alfred.NESWADBA
in reply to: jeff

Hi,

 

I would be thankful if that would work .. yes, it works in 98% but not for 100% as there are changes in signatures and also some (I say bug) modifications in the workflow of creating objects.

 

E.g. creating a Hatch-object:

Up to release 2010 you have to set first the hatch-angle and afterwards the hatch-pattern, beginning with 2011 that has to be reverted, otherwise you get an exception.

 

If you use e.g. the materials-library/-functionality ==> it's changed completly (some other lib's also, nearly all the 3D-stuff)

If you use Invokes, the destination-adresses differ between 32bit and 64bit (and - not sure now - I think also in few cases between AutoCAD-releases).

If you use ActiveX-components you have to difference between versions of e.g. the Civil-AeccApplication-object, look at this list:

  • for 2009 AeccXUiLand.AeccApplication.6.0
  • for 2010 AeccXUiLand.AeccApplication.7.0
  • for 2011 AeccXUILand.AeccApplication.8.0
  • for 2012 AeccXUiLand.AeccApplication.9.0

...and that you have to check in your code to have the correct string according to the Civil-release you aktually drive.

 

Ok, what I did now may look like a teacher ==> IMPORTANT I don't want to see my thread-input in that way!

I just want to show that it may look easy at the moment and as long as I just draw lines and arcs you will be able to use the same DLL for some releases of AutoCAD. But be carefull, if you tested it with 2009 there is no guerantee that it runs with 2010 or newer!

 

Hace a nice day and apologize my words, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 9 of 11

right, I understand there are code differences as the API develops through time.

I generally break out the version specific code into separate class files so I can still re-use most of the code.

I believe .net lets you put in conditional compile code too, to handle this.

 

I guess what I don't understand yet, is how a needed assembly would be found, that is not already loaded into acad.

I know .net will always look in the same folder as the running assembly, but how else does it look for them?

The answer might be "it does not, its either loaded and works, or in same folder and works, otherwise no searching..."

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 10 of 11

Hi,

 

it also looks in the GAC (Global Assembly Cache), for details look >>>here<<<

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 11 of 11
jeff
in reply to: Alfred.NESWADBA

If you want to see how it does see How the Runtime Locates Assemblies

 

If you create your own then probably found in Step 4: Locating the Assembly through Codebases or Probing

 

 

.NET handles all the references that are part of the Framework.

To run your application they must have .NET installed(same or a higher version) and knows where to find the references that are to assemblies that are part of the framework.

 

If you create your own assembly and reference it then Visual Studio will by default set Copy Local  to true which creates a copy in the same location as the assembly that references it and would be found in Step 4 or using .NET which can handle building then installing might make the information available to be found in Step 1: Examining the Configuration Files

 

 

There is a acmgd.dll and acdbmgd.dll that comes with every installtion of AutoCAD and is in the same location as the acad.exe which is loaded at startup, and that is why change Copy Local  to false. Since it is already loaded it wil be found in Step 2: Checking for Previously Referenced Assemblies

 

 

 

 

 

 

 

You can also find your answers @ TheSwamp

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost