Share via


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

Question

Thursday, May 9, 2013 11:38 PM

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

All replies (7)

Thursday, May 9, 2013 11:50 PM ✅Answered

You'll need to actually add the Microsoft.Practices assembly to your Project through the References as you would any other assembly : 

  • Right-click on your Project within the Solution Explorer.
  • Select Add Reference.
  • Browse to the location of your Microsoft.Practices.* DLL File (unsure on the exact name of the DLL files)
  • Click Ok to add it to your Project.

You can visit the Enterprise Library Site to see more about the actual Library itself and download it.


Friday, May 10, 2013 12:28 AM ✅Answered

Since you are using Visual Studio 2005, it looks like the most recent version of Enterprise Library that supports 2005 would be 3.1 (which has been retired and has not been maintained for quite some time).

I would highly consider downloading a newer version of Visual Studio (even an Express Version) if that is an option if you want to use Enterprise Library. The version that would be used for 2005 has been deprecated for several years and you'll find that many of the newer Microsoft Development products are not going to support 2005 either.


Thursday, May 9, 2013 11:50 PM

You first need to download Enterprise Library and then right click on the References in solution explorer and Add References to the EntLib dll files.


Thursday, May 9, 2013 11:54 PM

What version of Enterprise Library should I download?


Friday, May 10, 2013 1:02 AM

Thanks. But after downloading, installing and adding the reference I am still having the same error.


Friday, May 10, 2013 8:22 AM

The steps that I provided should be the proper way of handling it within your Project. Is it recognizing any of the Microsoft.Practices namespaces at all? (Are you sure that you added the correct binaries as References?)

I haven't worked with the Microsoft.Practices library much, but I would ensure the code you have matches the actual version that you downloaded (as you mentioned you had the code previously without the library). If it corresponds to a different version, there could be different (even slightly) assembly names, which could cause issues like this.

Apparently the library is called EnterpriseLibrary.dll according to this related discussion on using it. It may be worth reading to see if anything in it helps you out as it is from 2008 so will likely be targeting an older version.


Monday, May 13, 2013 8:13 PM

I've tried, installing Enterprise Library 4.1 (October 2008 ) instead of Enterprise Library 3.1 (May 2007) and it works without any error. 

Thanks Rion! Really appreciate it.