.net - VisualStudio错误?

标签 .net wpf visual-studio winforms

在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.dllPresenationFramework.dllWindowsBase.dll之类的引用,那么为什么不也添加System.Xaml.dll呢?

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

已在 Microsoft Connect 上报告了错误。

最佳答案

听起来您只需要引用System.Xaml.dll
关于这是否是VS中的错误;好吧,我想模板可以添加该引用-我可以复制它,因此值得logging on connect

关于.net - VisualStudio错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4387812/

相关文章:

ASP.NET 项目大小

visual-studio - Visual Studio 2017 : Disable Intellisense for CodeSnippets

.net - 当生产是32位时在64位机器上开发

c# - 我应该先在 EF 代码中映射双向关系的两侧吗?

c# - 如何在每个新页面上自动添加命名空间,控件添加到 VS2008 中的网站?

c# - 如何在 .net 核心 Controller 的新类对象中提供 ILogger<ClassName> 实例?

WPF TextBox.Focus() 的烦恼

.net - 将 WPF Canvas 子项绑定(bind)到 ObservableCollection

wpf - VM中的Usercontrol事件或MVVM中的View

c# - Visual Studio 和 C# : Finding conflicting definitions contained in namespaces