jeudi 18 février 2021

Using log4net in dynamically loaded assemblies

I have an application that uses reflection to dynamically load a plugin assembly using a common interface. The plugin wants to be able to use the logging library, specifically log4net available in the application and it actually can do so using the logger defined in the app.config, however this only works if the log4net referenced in the plugin solution matches the one found at runtime. The thing is I don't want to worry about this when deploying the plugin to the application, I'd like the plugin to use any log4net version available, as long as ILog interface is the same.

Let's say I have log4net 2.0.8 in my application but the plugin has a reference to 2.0.12, those have same ILog interface but I get error since version 2.0.12 is not found at runtime.

Is there any reasonable way around this?





Aucun commentaire:

Enregistrer un commentaire