gpt4 book ai didi

c# - 命名空间 'Practices' 中不存在类型或命名空间名称 'Microsoft'

转载 作者:太空狗 更新时间:2023-10-29 19:39:28 24 4
gpt4 key购买 nike

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

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

我一直收到这个错误:

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

我该怎么办?

提前致谢。 :)

最佳答案

除了引用项目中的 DLL 外,还要确保项目属性中的目标框架至少与 Microsoft 企业库版本一样高:

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

顺便说一句,下载 Enterprise Library 6.0:

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

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

关于c# - 命名空间 'Practices' 中不存在类型或命名空间名称 'Microsoft',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16474769/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com