问题描述
在VS 2010中创建了一个新的 WinForm
项目。添加了一个新的UserControl WPF。
In VS 2010 created a new WinForm
project. Added a new UserControl WPF.
出现2个编译时错误:
错误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?
=============
==============
在 。
Bug reported on Microsoft Connect.
推荐答案
听起来您只需要引用 System.Xaml.dll
这是否是VS中的错误;好吧,我想模板可以添加该引用-我可以复制它,因此它可能值得
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错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!