Re: Targetting a class library for both 3.5 and 2.0

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




Can't you just #if/#endif wrap the entire class definitions within the
3.5-specific classes? I don't see the need for extra solution files
or separate projects.

The complicated parts will be when there are interdependencies and
making sure that a 2.0 tareted class does not reference a 3.5-only
class. You'll find this pretty quick with automated build of both
targets thought (continuous integration would be good here). However,
keeping 3.5 specific stuff to an entirely 3.5-specific project would
make this process even easier.

HTH,

Sam


------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.



On Tue, 20 Nov 2007 15:38:31 +0100, Lasse Vågsæther Karlsen
<lasse@xxxxxxxxxxx> wrote:

I have a rather big class library solution with lots of projects.

Some of these projects I'd like to include .NET 3.5 things in, but only
when I'm targetting 3.5.

Basically, I'd like to be able to target 3.5 and rebuild, getting new
things into the new dll's for 3.5, and also be able to target 2.0 and
rebuild, to get files for 2.0.

What is the best way to do this? The "best" way I've come up with so far
is to make a new solution file and new project files with a named
definition and use #if..#endif to make files, or just not include the
3.5 files in the 2.0 projects, but this seems like a rather big
maintenance nightmare.

I'd like to have one solution and all of the projects once, and include
files that may or may not produce any compiled code depending on the target.

Or am I way off target here? Any thoughts would be welcome.

.