添加DLL引用DLL

2023-09-06 13:08:58 作者:折子戏

我有一个奇怪的问题添加DLL引用。我有一个WPF应用程序,我试图使用WPF MDI库: HTTP://wpfmdi.$c $ cplex.com /

正如中的说明(这是非常模糊的),我在VS2012右键点击引用,点击添加引用... ,点击浏览... 并加入我的DLL,我下载了。

接下来,我添加了我的窗口的XAML下面一行:的xmlns:MDI =CLR的命名空间:WPF.MDI;装配= WPF.MDI作为在说明中规定。

不过,尝试添加当< MDI:MdiContainer> ,会显示以下错误消息:

类型MDI:MdiContainer没有被发现。验证你是不是缺少程序集引用,并且所有引用的程序集已经建成。

命名为MdiContainer没有命名空间存在CLR命名空间:WPF.MDI;装配= WPF.MDI。

任何想法?

编辑:

补充我的XAML文件

 <窗​​口x:名称=...X:类=MyClass.MyClass
        的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/$p$psentation
        的xmlns:X =htt​​p://schemas.microsoft.com/winfx/2006/xaml
        的xmlns:MDI =CLR的命名空间:WPF.MDI;装配= WPF.MDI
        标题=的WindowState =最大化>
    < Window.Resources>
        <风格的TargetType =树视图>
            < setter属性=填充值=0,0,20,0/>
            < setter属性=BorderBrushVALUE =灰色/>
            < setter属性=了borderThicknessVALUE =0,0,5,0/>
        < /样式和GT;
    < /Window.Resources>
    < MDI:MdiContainer>< / MDI:MdiContainer>
< /窗>
 

解决方案

在 MDI项目项目似乎用.NET 4的客户端配置文件。只要确保WPF.MDI项目已使用.NET Framework 4运行时编译的。

I've got a strange problem adding a dll reference. I've got a WPF application and am trying to use the WPF MDI library: http://wpfmdi.codeplex.com/

C 中如何添加dll引用啊

As stated in the instructions (which are very vague), I right-clicked on references in VS2012, clicked on Add reference.., clicked on Browse.. and added my dll which I downloaded.

Next, I added the following line in the XAML of my window: xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI" as stated in the instructions.

However, when trying to add an <mdi:MdiContainer>, the following error messages are displayed:

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".

Any ideas?

EDIT:

Added my XAML file

<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>

解决方案

The project at MDI Project seems to use .Net 4 Client Profile. Just make sure the WPF.MDI project has been compiled using .Net Framework 4 runtime.