2

我在添加 dll 引用时遇到了一个奇怪的问题。我有一个 WPF 应用程序并正在尝试使用 WPF MDI 库:http ://wpfmdi.codeplex.com/

如说明中所述(非常模糊),我右键单击 VS2012 中的引用,单击Add reference..,单击Browse..并添加我下载的 dll。

接下来,我在窗口的 XAML 中添加了以下行:xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"如说明中所述。

但是,在尝试添加 时<mdi:MdiContainer>,会显示以下错误消息:

The type 'mdi:MdiContainer' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

The name "MdiContainer" does not exist in the namespace "clr-namespace:WPF.MDI;assembly=WPF.MDI".

有任何想法吗?

编辑:

添加了我的 XAML 文件

<Window x:Name="..." x:Class="MyClass.MyClass"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
        Title="" WindowState="Maximized">
    <Window.Resources>
        <Style TargetType="TreeView">
            <Setter Property="Padding" Value="0,0,20,0"/>
            <Setter Property="BorderBrush" Value="Gray"/>
            <Setter Property="BorderThickness" Value="0,0,5,0"/>
        </Style>
    </Window.Resources>
    <mdi:MdiContainer></mdi:MdiContainer>
</Window>
4

3 回答 3

3

MDI Project的项目似乎使用 .Net 4 Client Profile。只需确保已使用 .Net Framework 4 运行时编译 WPF.MDI 项目。

于 2012-10-14T17:37:00.347 回答
1

检查项目的 .NET Framework 设置。确保它未设置为.NET Framework Client Profile。因为根据我的经验,当框架设置不匹配时,通常会出现此错误。希望这可以帮助!

于 2012-10-14T17:09:07.897 回答
0

从MDI 项目下载 DLL 的源代码。重新编译到当前的 .net 版本,然后重新添加作为参考并重新编译您的项目。

于 2017-08-30T17:06:41.090 回答