Expression Blend 3 A类型无法转换为B类型 [英] Expression Blend 3 type A cannot be cast to type B

查看:76
本文介绍了Expression Blend 3 A类型无法转换为B类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Expression Blend 3中打开usercontrol(MyView)时出现问题。代码编译得很好,但Blend抱怨它无法实例化它,因为嵌入式用户控件(DrawControl)有错误。
/> Blend给出了这个原因:

[A] Present.GUI.Drawing.DrawControl不能转换为
[B] Present.GUI.Drawing.DrawControl。

类型A源自'Present.GUI.Drawing,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'在上下文'LoadNeither'中位置
'C:\ Users\xxx\AppData \ Local \ microsoft \Expression \Blend \Project Assemblies\3raq0s2s \ Present.GUI.Drawing.dll'。

类型B源自'Present.GUI.Drawing,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null',位于上下文'LoadNeither'位置为'C:\ Users \ xxxx \ AppData \ Local \ Mysoftoft \Expression \Blend \ Project Assemblies\un2d66d7 \ Present.GUI.Drawing.dll'。

对象'Present.GUI.Drawing.DrawControl'在标记文件'Present.GUI; component / usercontrols / multivideowindowcontrol.xaml'中出错。

这个当我将代码移出MyView程序集以放松组件之间的耦合时出现问题。 DrawControl驻留在一个单独的程序集中,并从MyView程序集中引用,这在Visual Studio中编译并运行得很好,但无法在Blend中加载。从Blend运行应用程序不是问题。

在Blend中构建Blend时,Blend似乎创建了所有.DLL文件的两个副本。这些文件放在Expression Blend的应用程序数据文件夹中,看起来像临时缓存文件夹。我不知道为什么要创建所有内容的两个副本,但它似乎是问题的根源,因为它抱怨两个文件不相同,并且不能在它们之间进行转换。

从MyView引用的所有程序集都会在缓存文件夹中得到重复项,所以我想知道这是设计还是我的项目设置错误?

解决方案

快速检查的一件事是找出引用此程序集的所有位置(我猜您的解决方案中有多个项目引用此程序集?)并确保所有引用都来自同一个物理如果您要设置一个解决方案,以便将程序集复制到多个项目中,并从这些项目的输出目录中进行引用,则可能会遇到此问题。 />
感谢,
乌尼

I am having trouble with opening a usercontrol (MyView) in Expression Blend 3. The code compiles fine, but Blend complains it can't instantiate it because an embedded usercontrol (DrawControl) has an error.

Blend gives me this reason:


    [A]Present.GUI.Drawing.DrawControl cannot be cast to
    [B]Present.GUI.Drawing.DrawControl.
       
    Type A originates from 'Present.GUI.Drawing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location
    'C:\Users\xxx\AppData\Local\Microsoft\Expression\Blend\Project Assemblies\3raq0s2s\Present.GUI.Drawing.dll'.
       
    Type B originates from 'Present.GUI.Drawing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location
    'C:\Users\xxx\AppData\Local\Microsoft\Expression\Blend\Project Assemblies\un2d66d7\Present.GUI.Drawing.dll'. 
       
    Error at object 'Present.GUI.Drawing.DrawControl' in markup file 'Present.GUI;component/usercontrols/multivideowindowcontrol.xaml'.


This issue arised when I moved code out of the MyView assembly to loosen the coupling between components. DrawControl resides in a separate assembly and is referenced from the MyView assembly, and this compiles and runs just fine in Visual Studio but fails to load in Blend. Running the application from Blend is not an issue.

It seems Blend creates two copies of all .DLL files when building inside Blend. These files are placed in the application data folder for Expression Blend, into what looks like temporary cache folders.
I don't know why it is creating two copies of everything, but it seems to be a source to the problem because it complains the two files are not equivalent and that it can't cast between them.

All assemblies referenced from MyView assmebly get duplicates in the cache folder, so I'm wondering if this is by design or if my project has faulty settings?

解决方案

The one thing to quickly check is to find out all the places where this assembly is referenced (my guess is you have multiple projects in your solution that reference this assembly?) and make sure that all the references are from the same physical location.

It is possible that you could run into this if you were to setup a solution such that an assembly was getting copied into multiple projects, and being references from the output directory of those projects.

Thanks,
Unni


这篇关于Expression Blend 3 A类型无法转换为B类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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