views:

47

answers:

1

for example: I have app A, which references library A and library B. in addition, library A itself references a different version of library B. (these are all in C#)

I want all references to point to a binary DLL file. right now I have a lib folder like so:

lib/LibA/v1/LibA_1.dll
lib/LibB/v1/LibB_1.dll
lib/LibB/v2/LibB_2.dll

let's say the app references LibA v1 and LibB v2, but LibA itself depends on LibB v1. what's the "right" way to set this up, if it's even possible? I'd like to avoid the GAC and minimize manual fiddling with files, because the idea is that a developer would be able to check out app A from svn and build it with no changes to paths/references, assuming they have the lib folder tree checked out.

right now I'm noticing that Visual Studio is not copying LibA's version of LibB to the output directory. is the file name difference enough, or do I have to change the version in the assembly itself?

+1  A: 

The right way to do this is to use ILMerge. When you compile LibA_1 use ILMerge to statically merge LibB_1 into the LibA_1 dll file. Your application will then reference LibA_1 and LibB_2 and will be none the wiser that LibA_1 actually has LibB_1 embedded in its dll file. I have used this approach before and it worked quite well.

This is really the only option you have unless you are ready to upgrade LibA_1 to use LibB_2. If LibB_1 and LibB_2 are significantly different then upgrading LibA_1 might be time consuming.

Brian Gideon