Search code examples
c#.netvisual-studioshared-librariesupdates

Sharing and updating a library


The facts:

  • I have a library called A.
  • I have two projects, B and C, referencing A.
  • When I compile B or C, they both create a compiled copy of A.

What I want to achieve is to create setup files for both B and C.
I also want them to use the same DLL file of A.

So if I install B 1.0 which has A 1.0 with it to a machine and then install the C 1.2 with A 1.2 with it, I want B to use the updated version of A.

How can I do this?

I think about saving the DLL file to a common place with the setup and dynamically loading it with the application, but I'm not sure. What is the best practice here? If I'm going to save it to a common place where would that be? Do setup projects that come with Visual Studio allow these kind of operations?

(I use .NET 4.5 on Visual Studio 2012.)


Solution

  • You can achieve this using assembly redirection. Please refer to Assembly Redirection