log4net dependency problem
Here is the link which describes what is happening and how to fix it:
https://docs.microsoft.com/en-us/archive/blogs/jmstall/viewing-types-with-reflection-only
An excerpt from the above link:
So what happened was that it tried to get the System.Type for Bar, but to resolve the type it needs to load the base class, which is in another dll. Reflection-Only context doesn't do binding policy so it can't find that dll. The LoaderException hint says to use the ReflectionOnlyAssemblyResolve, which provides more information about this.
To use the reflection API, you have to resolve all the dependencies used.
I had the same problem with log4net when creating a new WPF project and adding a reference to another project that referenced log4net. I resolved the issue by adding the log4net.dll to the GAC using these instructions: http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx
I know it's been a while but I wanted to share what solved it for me.
It looks like the main cause for this problem is the way log4net requires it's config file in the assembly info of the class library. WPF doesn't seem to like that. Referencing log4net in the wpf app itself caused the log4net config file to be overwritten for me, as the wpf app is later in the build order and generates a default log4net config file.
So to fix your class library for use with assembly preloading, edit it as follows:
In the class library delete this line in AssemblyInfo.cs :
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")]
Now in the entry point of your library setup your logger like this:
FileInfo configFileInfo = new FileInfo("log4net.config");
log4net.Config.XmlConfigurator.ConfigureAndWatch(configFileInfo);
If you setup log4net in the app.config file, just reference that one.
I found this solution here.