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