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

匿名 (未验证) 提交于 2019-12-03 08:41:19

问题:

I am using Microsoft Visual Studio 2005 for c# I have the following namespace on my code

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

and I keep on getting this error:

-The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

What should I do?

Thanks in advance. :)

回答1:

You should add a reference to the enterprise library from your project. You can download the dlls here: http://msdn.microsoft.com/en-us/library/ff648951.aspx



回答2:

As well as referencing the DLLs from the project, also make sure that the Target Framework in the project properties are at least as high as the Microsoft Enterprise Library version:

Also make sure it's not set to Client Profile (e.g. .NET Framework 3.5 Client Profile) otherwise you will also get the same error.

As an aside, to download the Enterprise Library 6.0:

  • run the self-extracting executable EnterpriseLibrary6-binaries.exe
  • run download script in PowerShell:
    • start an Administrator command prompt
    • navigate to the directory containing install-packages.ps1
    • use the command powershell -ExecutionPolicy ByPass -File install-packages.ps1

For 5.0, you can download the MSI and use Universal Extractor if you don't want to install the DLLs.



回答3:

The same issue is resolved for me when I changed my "Target Framework" from ".Net Framework 4 Client Profile' to '.Net Framework 4'.



回答4:

Visual Studio 2005 only supports raw .NET 2.0 projects.

You can see from this page that right now only a few releases are active,

  • Enterprise Library 6 - April 2013
  • Enterprise Library 5.0 - April 2010
  • Enterprise Library 5.0 Integration Pack for Windows Azure - November 2011
  • Enterprise Library 5.0 Integration Pack for Silverlight - May 2011
  • Enterprise Library 4.1 - October 2008

Even for 4.1, Visual Studio 2008 and above is required.

The last release supporting Visual Studio is the 3.1 release which is 6 years old.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!