WPF/VB6 interop not recognizing RibbonControlsLibrary

422 Views Asked by At

I'm working on a project that requires us to launch a .NET 4 (C#)/WPF Window from a VB6 application via a COM interop project. The WPF Window contains a reference to the Microsoft Ribbon for WPF component (RibbonControlsLibrary.dll, included as a dependency in the .NET interop project). Everything works fine when the window is opened from a .NET test client, but when it is opened from VB6 I get a XamlParseException during intstantiation of the Ribbon. Further debugging shows that the window is failing to parse because it cannot find RibbonControlsLibrary.dll, despite it being successfully copied to the interop project's output directory. Removing the Ribbon declaration from the window's XAML definition allows it to launch successfully, both from .NET and VB6.

This particular VB6 project has several corresponding .NET interop projects that reference pure .NET components in this fashion with no problem at all. What about the RibbonControlsLibrary component is different enough to cause this behavior?

1

There are 1 best solutions below

0
On BEST ANSWER

The issue here wasn't an assembly binding problem after all. It appears that the SmallImageSource attribute of RibbonButton, for whatever reason, wasn't recognized when the library is accessed by VB6 via a .NET COM interop class. In my case this attribute isn't necessary, so removing it solved the problem.