VisualStudio错误? [英] VisualStudio bug?

查看:87
本文介绍了VisualStudio错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS 2010中创建了一个新的 WinForm 项目。添加了一个新的UserControl WPF。

In VS 2010 created a new WinForm project. Added a new UserControl WPF.

出现2个编译时错误:


错误1类型
'System.Windows.Markup.IQueryAmbient'
是在未引用
的程序集中定义的。您必须在程序集 System.Xaml,
Version = 4.0.0.0,Culture = neutral,
PublicKeyToken = b77a5c561934e089中添加引用
。 D:\Projets\WindowsFormsApplication2\UserControl1.xaml.cs 20 26 WindowsFormsApplication2

Error 1 The type 'System.Windows.Markup.IQueryAmbient' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. D:\Projets\WindowsFormsApplication2\UserControl1.xaml.cs 20 26 WindowsFormsApplication2

错误2类型名称
'IComponentConnector'不能为
在命名空间
'System.Windows.Markup'中找到。此类型
已转发到程序集
'System.Xaml,版本= 4.0.0.0,
文化=中性,
PublicKeyToken = b77a5c561934e089'
考虑添加引用到该
程序集。 D:\Projets\WindowsFormsApplication2\obj\x86\Debug\UserControl1.g.cs 41100 WindowsFormsApplication2

Error 2 The type name 'IComponentConnector' could not be found in the namespace 'System.Windows.Markup'. This type has been forwarded to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. D:\Projets\WindowsFormsApplication2\obj\x86\Debug\UserControl1.g.cs 41 100 WindowsFormsApplication2

NB。

引用如 PresenationCore.dll PresenationFramework .dll WindowsBase.dll 会在向WinForm项目中添加新的WPF UserControl时自动添加,为什么不添加 System .xaml.dll 也是吗?

References like PresenationCore.dll, PresenationFramework.dll, WindowsBase.dll are added automatically when adding a new WPF UserControl to the WinForm project, so why not System.Xaml.dll too?

=============

==============

Microsoft Connect

Bug reported on Microsoft Connect.

推荐答案

听起来您只需要引用 System.Xaml.dll

这是否是VS中的错误;好吧,我想模板可以添加该引用-我可以复制它,因此它可能值得登录connect

Re whether this is a bug in VS; well, I suppose the templates could add that reference - I can reproduce it, so it may be worth logging on connect

这篇关于VisualStudio错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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