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

QKWS picture QKWS · May 10, 2013 · Viewed 32.5k times · Source

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. :)

Answer

SharpC picture SharpC · Nov 4, 2014

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.