views:

194

answers:

2

Hello all,

I'm creating .net websites against a CMS server using the API of the software vendor.

The problem is that for every version of the CMS software I have different DLLs (mostly unversioned) that I have to deal with.

So, right now I am building some reusable server components that depend on these DLLs, but since I want to use these components against different websites with different DLL versions I need to come up with a way to switch the dependencies.

Is it possible to bundle all dependencies in a single DLL (and keep the original namespaces)?

+1  A: 

There's ILMerge from Microsoft Research that allows you to combine multiple assemblies into single and keeping original namespaces.

Darin Dimitrov
The tool does an excellent job. There are a couple of assemblies that could not be merged but it seems promising.
pablo
A: 

If there's a namespace clash you might be eventually forced to dynamically load the DLL. You can do this using the Assembly class and a bit of reflection to grab the appropriate entry-points.

In short, you wouldn't depend on the API compile time, and instead make your own wrapper, implementing said wrapper using dynamically (via reflection) invoked calls to the dll. I'm sure this is easier in C# 4.0, but it'll work fine in 1.0 too.

Eamon Nerbonne