LibZ icon indicating copy to clipboard operation
LibZ copied to clipboard

WPF Resource Dictionary Resolution

Open rrs opened this issue 8 years ago • 2 comments

I have a WPF project with a dependency on another project that contains lots of WPF resource dictionaries for various styles etc. I bundle all dlls into Libz containers, inject them into the exe and then instrument them in the usual way. When the app starts I get an error saying assembly with the resource dictionary cannot be found.

Is it possible to work around this using a similar technique to the MEF solution? I am not sure how to go about this and there isn't a similar example.

rrs avatar Dec 22 '16 14:12 rrs

I have the exact same problem. Please let me/us know if you ever find a solution to this issue...

badclone avatar Mar 07 '17 23:03 badclone

Add LibZ.Library from Nuget

using LibZ.Bootstrap; in your application entry point. In my case its a dll, but likely in App.xaml

Use the following on any top level forms

LibZResolver.Startup(() =>
{
    w.ShowDialog();
});

then add a step to your packaging process to manually inject the LibZ.Bootstrap dll into your .exe (rather than include it in a Libz container)

example for windows

libz inject-dll --assembly "%target%" --include "LibZ.Bootstrap.dll" --move

I essentially started faffing with scenario 5 and found that the startup part was enough to make it work

https://github.com/MiloszKrajewski/LibZ/blob/master/doc/scenarios.md#scenario-5-getting-more-control

See if that works for you. I have a little more to get mine to work, as I mentioned my entry point is from a COM visible dll and needed some extra code for assembly resolution.

rrs avatar Mar 08 '17 07:03 rrs