集引用不是在XAML中,但code将编译xaml.cs上课的时候​​引用 [英] Assembly reference not found in XAML, but code compiles when referenced in xaml.cs class

查看:196
本文介绍了集引用不是在XAML中,但code将编译xaml.cs上课的时候​​引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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/

正如中的说明(这是非常模糊的),我在VS2012右键点击引用,点击添加引用... ,点击浏览... 并加入我的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.

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

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.

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

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

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

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

这是我的XAML:

<Window x:Class="QueryBuilder.Table"
        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"
        Height="300" Width="300" WindowStyle="ToolWindow" ResizeMode="NoResize" ShowInTaskbar="False">
</Window>

此问题已得到了一整天​​折腾我。我已经试过几乎所有可以想象的。有一点值得注意的是,我已经downlaoded从图书馆的网站上的示例应用程序,我可以没有任何问题运行。除此之外,我已经加入这个的xaml.cs类我的项目: WPF.MDI.MdiContainer D =新WPF.MDI.MdiContainer(); ,并将它与编译没有任何问题。

This problem has been frustrating me all day. I've tried almost everything imaginable. One thing worth noticing is that I've downlaoded the sample application from the library's site, and I can run it with no problems. Besides this, I have added this to the xaml.cs class of my project: WPF.MDI.MdiContainer d = new WPF.MDI.MdiContainer(); and it compiles with no problems at all.

请也注意到,有人问我最初的问题<一href="http://stackoverflow.com/questions/12884408/adding-dll-reference/12884756#comment17447229_12884756">here,并且没有任何的建议工作。这个问题现在已经改不过,由于这似乎表明,code编译成功在$ C $落后C,但不是在XAML文件中的上段。

Please also note that my initial problem was asked here, and none of the suggestions worked. The problem has now changed however, due to the above paragraph which seems to indicate that the code is compiled successfully in the code behind, but not in the XAML file.

编辑:我还想补充一点,我能够浏览程序集引用的code,如下图所示。

I would also like to add that I am able to browse through the code of the assembly reference as shown below.

推荐答案

我终于解决了自己的问题 - 要离开这个答案在这里柜面有人有同样的问题一段时间。添加解决方案本身的组件的参考路径解决问题!这是一个耻辱,这是没有记录...

I've finally solved the problem myself - going to leave this answer here incase someone has the same problem some time. Adding the solution itself to the reference path of the assembly solves the problem! It's a shame this isn't documented...

编辑::要澄清一下,我所做的就是添加解决方案,而不是DLL。换句话说,我加入了所有类的MDI解决方案。这自然适用于DLL文件,其中源$ C ​​$ C可得。

To clarify, what I did was add the solution, rather than the dll. In other words, I added the MDI solution with all its classes. This naturally applies to DLLs where the source code is available too.

这篇关于集引用不是在XAML中,但code将编译xaml.cs上课的时候​​引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆