1

我们有一个应用程序和一个 Visual Studio 加载项,它们都从位于用户计算机上其他位置的 Mef 程序集加载其(模块化)功能,而不是应用程序本身安装。

现在我们的一位开发人员使用 Wpf(使用 Prism/System.Windows.Interactivity)为新模块创建 UI 组件,但不幸的是,现在模块/Xaml Parser 抛出XamlParseException说它无法加载 System.Windows.Interactivity.dll和查看融合日志基本上表明它寻找/所在的路径是托管 .exe 运行的路径,而不是 Mef 模块(包含 wpf / xaml ui)所在的路径。

System.Windows.Interactivity.dll 实际上驻留在 Mef 的模块/程序集目录中(在该 mef 模块/程序集中引用并将本地复制设置为 true)所以我想知道我们将如何为 System.Windows.Interactivity 指定命名空间正确地低于所以程序集加载实际上也在程序集的目录中查找?

<UserControl x:Class="TestExplorer.Modules.DocumentChecks.DocumentChecksMainWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:Converter="clr-namespace:TestExplorer.Modules.DocumentChecks.Converter"
             xmlns:TreeView="clr-namespace:TestExplorer.Modules.DocumentChecks.TreeView" mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="500">

这里有一个条目存在完全相同的问题(请参阅Prism 程序集参考失败: System.Windows.Interactivity),但是添加 prism/system.windows.interactivity 作为对托管应用程序的引用的解决方案只是一种解决方法,充其量 - 它基本上破坏了应用程序的模块化目的(别管我们不能将 system.windows.interactivity 部署到 devenv.exe 的位置,以防用户使用我们的 Visual Studio Addin.. 并且 devenv.exe 是那里的托管进程) .

4

0 回答 0