在VS 2010中创建了一个新的WinForm
项目。添加了新的UserControl WPF。
出现2个编译时错误:
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
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
注意。
当向WinForm项目添加新的WPF用户控件时,会自动添加诸如
PresenationCore.dll
,PresenationFramework.dll
,WindowsBase.dll
之类的引用,那么为什么不也添加System.Xaml.dll
呢?==============
已在 Microsoft Connect 上报告了错误。
最佳答案
听起来您只需要引用System.Xaml.dll
关于这是否是VS中的错误;好吧,我想模板可以添加该引用-我可以复制它,因此值得logging on connect
关于.net - VisualStudio错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4387812/