Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 334
QKWS Avatar asked May 10 '13 03:05

QKWS


2 Answers

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:

  • Enterprise Library 6.0 - .NET Framework 4.5 (so you probably want Visual Studio 2012 - if you use 2010 / 4.0 you get the error Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib')
  • Enterprise Library 5.0 - .NET Framework 3.5
  • Enterprise Library 4.1 - .NET Framework 3.5

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.

like image 125
SharpC Avatar answered Sep 17 '22 11:09

SharpC


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

like image 40
Chief Wiggum Avatar answered Sep 19 '22 11:09

Chief Wiggum