WPF设计器在查看新添加的用户控件时导致异常 [英] WPF Designer causes exception when viewing newly added user control

查看:94
本文介绍了WPF设计器在查看新添加的用户控件时导致异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个非常简单的WPF类库.我添加了一个新窗口和一个新的用户控件.当我双击任何一个xaml文件时,都会收到以下类型的异常:

Hi,
I have a very simple WPF class library. I added a new window and a new user control. When I double click on either of the xaml files, I receive the following type of exception:

The specified module could not be found. (Exception from HRESULT: 0x8007007E)<br />
   at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)




有一个链接可以重新加载设计器,但是仍然存在异常.这非常烦人,因为我无法使用设计器查看或修改UI.为什么即使在新的用户控件上也会出现此异常?




There is a link to reload the designer however the exception still remains. This is extremely annoying as I cannot view or modify my UI using the designer. Why am I getting this exception, even on a new user control?

推荐答案

在尝试使用该应用程序之前,必须确保已使用新的用户控件对应用程序进行了编译
You have to make sure the app is compiled with the new user control before trying to use it in the designer.


事实证明,如果删除一个引用(来自另一个API),则可以在Designer预览中看到我的UI.
但是,这很奇怪,因为这些DLL位于我的构建文件夹中,并且我的项目成功构建.设计器为什么会对这些引用有疑问?
It turns out that if I remove one of my references (coming from another API), then I can see my UI in the Designer preview.
This is strange though, as those DLL''s reside in my build folder, and my project builds successfully. Why would the Designer have issues with these references?


这篇关于WPF设计器在查看新添加的用户控件时导致异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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