C# Class Library dependencies conflicts

2k Views Asked by At

I'm developing API class library and i need to use some external libraries, e.g. log4net, unity, etc. When i reference these libs my API's clients experience problems referencing the same libraries with of another versions. How can make this references 'private' without ILMERGE usage

1

There are 1 best solutions below

4
On

There is no such thing like 'private references'.
The .NET runtime will load any assembly only once into an app's domain and distinguishes them by name only, not by version. Therefore, you'll need to make sure that all of your merged code is actually using the same version of a certain library or allow different versions using Assembly Version Redirects (via <bindingRedirect> elements in your app.config) where appropriate.