DLL remains in referenced libraries after inject-dll

Jan 27, 2015 at 2:58 PM
Hello,
I'm looking for a solution how to turn a bunch of dll's into one and LibZ seem so far as the most elegant solution, but I can't make it work somehow:(. I'm creating a sort of "plugin" dll for a master application, where I don't want to involve additional references and all I want to create is a standalone DLL at most with a few dependencies that the master program includes anyway (System.Core, System.Xml, ...).

I tried to create a standalone project DebugToy to demonstrate the behavior I'm stuck at with linking additional log4net.dll. After building the dll the references in ILSpy show as:
Image

Now I run this command to inject the log4net library:
libz inject-dll --assembly DebugToy.dll --include=log4net.dll --move

And this is what I get (the reference to log4net still remains, though it seems that it's dependencies are no more displayed in the tree):
Image

Anyway the final DLL fails to load in the master application and cries for missing log4net dependency:(.

What I would expect is that the log4net reference would disappear and it's dependencies would be added. I'd like to know if I'm missing something or if there's some feature with transitive referenced libraries or why it doesn't work. Should I inject dll's in some order so that the latter injected dll's already see that their referenced libraries are already injected? I'm not able to figure this out:(

Thank you so much.
Lukas
Coordinator
Jan 28, 2015 at 8:12 AM
If you can prepare demo project I could take a look at that. For now I would bet on (see this):
NOTE: injecting dll (skipping the container part, see below) injects very simple assembly resolver. It is actually that simple that it cannot resolve assemblies by partial names. If you use partial names (for example, you use NHiberante and configure it with .hbm files) please use .libz container (embedded or not, doesn't matter). Only container resolver support partial names.
Try to use scenario 4.
Jan 28, 2015 at 4:00 PM
Uff ... so I spent whole day trying to make this work and I think I found it out the source ... the trouble comes when I try to extend a class that is contained within an injected library. I had a Log appender extending one from log4net library and when I comment it out everything runs ok. I also prepared a demo project you can take a look at.

It's in my dropbox, but I won't keep it there forever: https://dl.dropboxusercontent.com/u/36622208/LibZ/LibZ_DependencyTest.zip
MainLibrary is running libz by post-build event command line.
There are also two versions of ClassFromMainLibrary ... one that uses inheritance makes it fail, the other uses delegation and it works fine.