Code Red > .NET

Multiple CAD version DLL

(1/2) > >>

pBe:
Hi Swampers

How do you deal with a single dll file to work on mutliple versions of Autocad, been working on a .net C# codes that deals with Sheet Set, among the required reference is the the file Interop.ACSMCOMPONENTS##Lib.dll


--- Code - C#: --- using ACSMCOMPONENTS19Lib;  //Autocad 14 using ACSMCOMPONENTS20Lib;  //Autocad 15 using ACSMCOMPONENTS21Lib;  //Autocad 17
Not even sure i can load multiple reference of those shown above, tried it , it wont accept it though.

I figured to use Application.Version and pass the result to a switch statement.


--- Code - C#: ---string acadver = Autodesk.AutoCAD.ApplicationServices.Core.Application.Version.ToString();
After that i'm stump.

Any ideas?

kpblc:
I think you have to create some different projects and compile it to different locations.

gile:
Hi,

I think you have to build three different DLLs (i.e. 3 different projects in Visual Studio).
Anyway, these projects can be in the same Visual Studio solution and share the same code.

Create a first project (SheetSetProject_19 for example) referencing ACSMCOMPONENTS19Lib.
Add a conditional compilation symbol in the project properties > Build tab (ACAD_19 for example)
Write the code for this project with conditional compilation directives in the using directives:

--- Code - C#: ---#if ACAD_19using ACSMCOMPONENTS19Lib;#elif ACAD_20using ACSMCOMPONENTS20Lib;#elif ACAD_21using ACSMCOMPONENTS21Lib;#endif
Add a new project to the solution (SheetSetProject_20) referencing ACSMCOMPONENTS20Lib with a conditional compilation symbole (ACAD_20)
From the Project menu > Add Existing Item > browse to the Project_19 folder > select the code files to share > from the Add button drop-down list, select Add As Link.

Idem for SheetSetProject_21.

You can also set the same Output Path for the 3 projects in Release mode (in the Build tab of the projects properties).

It's Alive!:
Alternatively, you might be able to use late binding.  probably more difficult though  :|

pBe:

--- Quote from: gile on February 08, 2017, 03:24:38 AM ---
I think you have to build three different DLLs (i.e. 3 different projects in Visual Studio).
Anyway, these projects can be in the same Visual Studio solution and share the same code.

Create a first project (SheetSetProject_19 for example) referencing ACSMCOMPONENTS19Lib.....

--- End quote ---

I will try this, I'll let you guys know how it goes,
thank you gile


--- Quote from: kpblc on February 08, 2017, 01:55:01 AM ---I think you have to create some different projects and compile it to different locations.

--- End quote ---

Thanks buddy


--- Quote from: nullptr on February 08, 2017, 04:07:01 AM ---Alternatively, you might be able to use late binding.  probably more difficult though  :|

--- End quote ---

Too complicated for me, (dont even know what it is :) ) someday maybe, thanks

Navigation

[0] Message Index

[#] Next page

Go to full version