[英]Adding dll reference
I've got a strange problem adding a dll reference. 我在添加dll引用时遇到了一个奇怪的问题。 I've got a WPF application and am trying to use the WPF MDI library: http://wpfmdi.codeplex.com/
我有一个WPF应用程序,正在尝试使用WPF MDI库: http : //wpfmdi.codeplex.com/
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. 如说明中所述(非常模糊),我右键单击VS2012中的引用,单击“
Add reference..
,单击“ Browse..
然后添加我下载的dll。
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. 接下来,我在窗口的XAML中添加了以下行:
xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
如说明中所述。
However, when trying to add an <mdi:MdiContainer>
, the following error messages are displayed: 但是,当尝试添加
<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".
Any ideas? 有任何想法吗?
EDIT: 编辑:
Added my XAML file 添加了我的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>
The project at MDI Project seems to use .Net 4 Client Profile. MDI项目中的项目似乎使用.Net 4客户端配置文件。 Just make sure the WPF.MDI project has been compiled using .Net Framework 4 runtime.
只需确保WPF.MDI项目已使用.Net Framework 4运行时进行了编译。
Check .NET Framework settings of your project. 检查项目的.NET Framework设置。 Make sure it is not set to .NET Framework Client Profile .
确保未将其设置为.NET Framework Client Profile 。 Because as per my experience this error usually appears when there is a mismatch in the framework settings.
因为根据我的经验,此错误通常在框架设置不匹配时出现。 Hope this helps!
希望这可以帮助!
Download the source for the DLL from the MDI Project . 从MDI项目下载DLL的源代码。 Recompile to current .net version and then re-add as a reference and recompile your project.
重新编译为当前.net版本,然后重新添加为参考并重新编译您的项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.