日期:2014-05-17  浏览次数:20749 次

vs2005+.net framework4.0 命名空间“System.Windows”中不存在类型或命名空间名称Documents
vs2005环境下,安装了.net framework4.0,添加了以下using:
using System;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
仍然报错:

命名空间“System.Windows”中不存在类型或命名空间名称“Controls”(是缺少程序集引用吗?)
命名空间“System.Windows”中不存在类型或命名空间名称“Documents”(是缺少程序集引用吗?)
找不到类型或命名空间名称“DependencyProperty”(是否缺少 using 指令或程序集引用?)

------解决方案--------------------
即使你安装了.NET 4.0,你在VS2005中也是不可以引用.NET 4.0下的dll

你需要引用.NET2.0下与之对应的dll
------解决方案--------------------
探讨

我用using System.Windows.Forms;代替using System.Windows.Controls;和
using System.Windows.Documents;报错就消失了,不知道是否解决的问题,不过仍然有一个错误:
找不到类型或命名空间名称“DependencyProperty”(是否缺少 using……
不知道这个是因为什么

------解决方案--------------------
装2010吧,你需要的这些命名空间和类都是WPF的,但是2005不支持WPF开发