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. :)
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
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.
The same issue is resolved for me when I changed my "Target Framework" from ".Net Framework 4 Client Profile' to '.Net Framework 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.