Linking the same code to different versions of assembly

C

carlos

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
 
J

Jon Skeet [C# MVP]

carlos said:
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?

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
 
A

Arne Vajhøj

carlos said:
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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top