The type or name of the Practice namespace does not exist in the Microsoft namespace,

I am using Microsoft Visual Studio 2005 for C # I have the following namespace in my code

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

and I keep getting this error:

- The type or name of the Practice namespace does not exist in the Microsoft namespace (do you miss the assembly reference?)

What should I do?

Thanks in advance.:)

+8
c # namespaces visual-studio enterprise-library
source share
4 answers

You must add a link to the corporate library from your project. You can download the DLL here: http://msdn.microsoft.com/en-us/library/ff648951.aspx

+1
source share

Also, referring to the DLLs from the project, make sure that the Target Framework in the project properties is not less than the version of the Microsoft Enterprise Library:

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

Also make sure that it is not configured for the client profile (for example, the .NET Framework 3.5 client profile), otherwise you will also get the same error.

As an aside, to download Enterprise Library 6.0:

  • run the self-extracting executable file EnterpriseLibrary6-binaries.exe
  • run loading script in PowerShell:
    • run admin command line
    • go to the directory containing install-packages.ps1
    • use powershell -ExecutionPolicy ByPass -File install-packages.ps1

In version 5.0, you can download MSI and use the Universal Extractor if you do not want to install DLLs.

+4
source share

Visual Studio 2005 supports only .NET 2.0 source projects.

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

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

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

The latest version that supports Visual Studio, release 3.1, which is 6 years old.

0
source share

The same problem was resolved for me when I changed my "target structure" from ".Net Framework 4 Client Profile" to ".Net Framework 4".

0
source share

All Articles