10

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

pnuts
  • 58,317
  • 11
  • 87
  • 139
QKWS
  • 1,069
  • 9
  • 22
  • 41

4 Answers4

4

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.

Community
  • 1
  • 1
SharpC
  • 6,974
  • 4
  • 45
  • 40
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

Chief Wiggum
  • 2,784
  • 2
  • 31
  • 44
  • 3
    [Nuget](http://nuget.org/packages?q=enterpriselibrary) is another option instead of downloading the assemblies. – Steven V May 10 '13 at 03:40
  • Yes that would be my recommended solution as well, but there is no official VS2005 support for nuget as far as I know. Or is there? – Chief Wiggum May 10 '13 at 03:43
  • 1
    Good point. According to http://stackoverflow.com/a/7558894/254973 there is a crazy way to piece something together. But it's probably more trouble that it's worth since it would create more external work in the event someone else needs to use the project. Assemblies it is! – Steven V May 10 '13 at 03:47
  • Ah, I was no aware of Scotts article, good to know. You can always run nuget.exe outside the VS environment to get the files, but as you already mentioned: It's easier to just download the libs if you're running VS2005. – Chief Wiggum May 10 '13 at 03:50
  • What version should I download? – QKWS May 10 '13 at 03:55
  • What .net framework are you using? I would probably get the newest (6) one: http://www.microsoft.com/en-us/download/details.aspx?id=38789 – Chief Wiggum May 10 '13 at 03:58
  • Did that work for you? In case it did, please mark to question as answered. Thx – Chief Wiggum May 10 '13 at 04:14
  • But I would recommend to you to update your whole solution including Visual Studio and the .net Framework if that's possible. A lot of (good) things happend since .net 2.0... – Chief Wiggum May 10 '13 at 07:11
1

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

0

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.

Lex Li
  • 60,503
  • 9
  • 116
  • 147