I am creating a library that needs to be make in two versions. The
code is the same, but the
assembly that I reference has different implementations. How can I
create two separate versions of
this library using the same code? My current solution is to have the
same code in two separate
projects, each linked to the version of the assembly that I use.
This is a poor solution, of course. Do you have any suggestions to
improve this?
Thanks,
-Carlos Oliveira
Jon Skeet [C# MVP] - 07 Mar 2008 14:23 GMT
> I am creating a library that needs to be make in two versions. The
> code is the same, but the
[quoted text clipped - 6 lines]
> This is a poor solution, of course. Do you have any suggestions to
> improve this?
With a bit of hand-crafting of project files, you can have different
references for different configurations.
If you download MiscUtil, have a look at the project files for that -
you can build it in a .NET 2.0 configuration (which doesn't include the
3.5 assemblies) or a .NET 3.5 configuration (which does, obviously).
http://pobox.com/~skeet/csharp/miscutil

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Arne Vajhøj - 08 Mar 2008 03:49 GMT
> I am creating a library that needs to be make in two versions. The
> code is the same, but the
[quoted text clipped - 6 lines]
> This is a poor solution, of course. Do you have any suggestions to
> improve this?
I don't think that is different from any other plugin style
solution.
Your main stuff has an interface. Some DLL's each has a
class that implement that interface. Based on configuration
or user interaction that app loads a specific DLL and
create an instance of the class implementing the
interface.
You can code it yourself i relative few lines or
use a framework like Spring.NET.
Arne