繁体   English   中英

命名空间“Microsoft”中不存在类型或命名空间名称“Practices”

[英]The type or namespace name 'Practices' does not exist in the namespace 'Microsoft'

我正在使用Microsoft Visual Studio 2005进行c#我的代码上有以下命名空间

using Microsoft.Practices.EnterpriseLibrary;
using Microsoft.Practices.EnterpriseLibrary.AppSettings;
using Microsoft.Practices.EnterpriseLibrary.Data;

我继续得到这个错误:

- 命名空间“Microsoft”中不存在类型或命名空间名称“实践”(您是否缺少程序集引用?)

我该怎么办?

提前致谢。 :)

除了从项目引用DLL之外,还要确保项目属性中的Target Framework至少与Microsoft Enterprise Library版本一样高:

还要确保它没有设置为客户端配置文件(例如.NET Framework 3.5 Client Profile),否则您也会收到相同的错误。

另外,要下载Enterprise Library 6.0:

  • 运行自解压可执行文件EnterpriseLibrary6-binaries.exe
  • 在PowerShell中运行下载脚本:
    • 启动管理员命令提示符
    • 导航到包含install-packages.ps1的目录
    • 使用命令powershell -ExecutionPolicy ByPass -File install-packages.ps1

对于5.0,如果您不想安装DLL,可以下载MSI并使用Universal Extractor

您应该从项目中添加对企业库的引用。 你可以在这里下载dll: http//msdn.microsoft.com/en-us/library/ff648951.aspx

当我将“目标框架”从“.Net Framework 4 Client Profile”更改为“.Net Framework 4”时,我解决了同样的问题。

Visual Studio 2005仅支持原始.NET 2.0项目。

您可以在此页面中看到,现在只有少数版本处于活动状态,

  • 企业图书馆6 - 2013年4月
  • 企业库5.0 - 2010年4月
  • 适用于Windows Azure的Enterprise Library 5.0 Integration Pack - 2011年11月
  • 适用于Silverlight的Enterprise Library 5.0集成包 - 2011年5月
  • 企业图书馆4.1 - 2008年10月

即使对于4.1, 也需要Visual Studio 2008及更高版本

支持Visual Studio的最后一个版本是6.1版 ,已有6年历史。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM