Using two different versions of the same library

I am developing a small library that will be used in several applications. I would like to use some third-party libraries in my own library (e.g. log4Net, Entity Framework, etc.). I would suggest that I can either deploy the DLLs with my own library, or use ILMerge to create a single DLL (I know little about ILMerge never tried).

I am worried about what happens if the applications that consume my library also use the same third-party libraries that I will use. For example, if I use log4Net version 1.2, and the consumer application uses log4Net version 1.0, will I get some kind of conflict or only one version of the assembly will not be downloaded?

Does ILMerge prevent this? How is this usually resolved when developing a library with third-party dependencies?

+4
source share
2 answers

You can use the alias extern :

You may need to reference two versions of assemblies that have the same fully qualified type name. For example, you may have to use two or more versions of an assembly in one application. Using an external assembly alias, the namespaces from each assembly can be wrapped in root namespaces called an alias, which allows them to be used in the same file.

Here's the walkthrough of the alias Extern .

+3
source

The best way would be to deploy next to your application. NuGet handles such dependencies very well. Unless you have a specific reason to use ILMerge, it will just make your life harder - perhaps you want to update, for example.

0
source

Source: https://habr.com/ru/post/1485122/


All Articles