WPF/VB6 互操作无法识别 RibbonControlsLibrary
我正在开发一个项目,该项目要求我们通过 COM 互操作项目从 VB6 应用程序启动 .NET 4 (C#)/WPF 窗口。 WPF 窗口包含对 Microsoft Ribbon for WPF 组件(RibbonControlsLibrary.dll,作为 .NET 互操作项目中的依赖项包含)的引用。当从 .NET 测试客户端打开窗口时,一切正常,但是当从 VB6 打开窗口时,我在功能区实例化期间收到 XamlParseException。进一步的调试显示窗口无法解析,因为它找不到 RibbonControlsLibrary.dll,尽管它已成功复制到互操作项目的输出目录。从窗口的 XAML 定义中删除功能区声明使其能够从 .NET 和 VB6 成功启动。
这个特定的 VB6 项目有几个相应的 .NET 互操作项目,它们以这种方式引用纯 .NET 组件,没有任何问题。 RibbonControlsLibrary 组件的差异足以导致此行为吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的问题毕竟不是程序集绑定问题。看来,当 VB6 通过 .NET COM 互操作类访问该库时,无论出于何种原因,RibbonButton 的 SmallImageSource 属性都无法识别。就我而言,这个属性不是必需的,因此删除它可以解决问题。
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.