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

Multiple version of AutoCAD

3 REPLIES 3
Reply
Message 1 of 4
wesbird
375 Views, 3 Replies

Multiple version of AutoCAD

Hi:
I have progrmming in .net since 06. I spent a little time on 07 and now 08 coming. My question, If I have a project, I would like to make it work for 06, 07 and 08. What should I do?
I was thinking, I will have different project file for different AutoCAD, e.g. MyProject06 for 06, MyProject07 for 07, ... In different project all point to same source code. In source code, I will put compile condition for version special code. Is this work?


Thank you,

Wes
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: wesbird

.NET 1.0 (used in AutoCAD 2006) is very upward compatible with .NET 2.0
(used in AutoCAD 2007 & 2008). Given that, it should be possible to create
a single AutoCAD 2006-based .NET application and have it work unchanged in
2007 and 2008.

If you need to use any ObjectARX, your task becomes more difficult as
AutoCAD 2006 requires Visual Studio 2002, while AutoCAD 2007 must use Visual
Studio 2005.

Dan

wrote in message news:5505644@discussion.autodesk.com...
Hi:
I have progrmming in .net since 06. I spent a little time on 07 and now 08
coming. My question, If I have a project, I would like to make it work for
06, 07 and 08. What should I do?
I was thinking, I will have different project file for different AutoCAD,
e.g. MyProject06 for 06, MyProject07 for 07, ... In different project all
point to same source code. In source code, I will put compile condition for
version special code. Is this work?


Thank you,

Wes
Message 3 of 4
Anonymous
in reply to: wesbird

I've been down this road so here's what I can
offer:

You can create separate solutions for each
target release and include the source files by
reference (e.g., link rather than insert).

That will allow you to build multiple solutions
from the same source files, even using different
versions of Visual Studio and the framework.

To link a file into your project use "Add Existing
Item", and select the file in the file dialog, but
rather than clicking the "Add" button, click the
little dropdown arrow to the right, and choose
"Add as link" from the dropdown menu.

This adds the file to your project but does not
copy it into your project folder.

Another way to make things easier is to organize
your code so that the parts that are not release-
dependent (e.g., same code used for any release)
are isolated at the source file level.

You can put release-dependent code in different
files and then include only the ones specific to the
release your solution targets, and you can use
conditional compilation in your code to selectively include/exclude code for each target release, by
defining symbols to use as the trigger.

For example, you can define symbols like AC2005,
AC2006, AC2007, and so on. Then you can use them
in your code with the conditional attribute to control
inclusion/exclusion of methods, or #ifdef to control
inclusion/exclusion of code and using clauses:

[Conditional("AC2006")]
public static void AcadVersion()
{
Console.WriteLine("This is AutoCAD 2006");
}

[Conditional("AC2007")]
public static void AcadVersion()
{
Console.WriteLine("This is AutoCAD 2007");
}

The conditional attribute will include the method in
your code only if the specified symbol is defined, and
exclude it otherwise (here you would need to have
a version of the method for each target release, each
using the conditional symbol for that release, or calls
to the method will result in errors).

You can also use conditional compilation with code
and with using clauses:

#if ! AC2005
using Autodesk.AutoCAD.EditorInput;
#endif

Here, the using clause would be ignored if your
solution is targeting AutoCAD 2005, using the symbol
AC2005 to indicate the targeted release.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5505644@discussion.autodesk.com...
Hi:
I have progrmming in .net since 06. I spent a little time on 07 and now 08 coming. My question, If I have a project, I would like to make it work for 06, 07 and 08. What should I do?
I was thinking, I will have different project file for different AutoCAD, e.g. MyProject06 for 06, MyProject07 for 07, ... In different project all point to same source code. In source code, I will put compile condition for version special code. Is this work?


Thank you,

Wes
Message 4 of 4
wesbird
in reply to: wesbird

Thank you, Tony and J. Daniel Smith


Wes
Windows 10 64 bit, AutoCAD (ACA, Map) 2023

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