views:

62

answers:

3

I am trying to copy code from one project to another. There is one problem however:

The type 'Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null'.

The problem is that I can't find Microsoft.Practices.* anywhere. Anyone know where I can find this file?

+3  A: 

you need to install EnterpriseLibrary.

From MSDN:

The Microsoft Enterprise Library is a collection of reusable software components (application blocks) designed to assist software developers with common enterprise development cross-cutting concerns (such as logging, validation, data access, exception handling, and many others). Application blocks are a type of guidance; they are provided as source code, test cases, and documentation that can be used "as is," extended, or modified by developers to use on complex, enterprise-level line-of-business development projects.

Vinay B R
+1  A: 

See the 'Downloads' section here and choose "Enterprise Library 3.1 May 2007 (for .NET Framework 2.0 and 3.0)."

Jeff Sternal
The thing is though, in the other project that this code was from, it works. And its all on the same computer
0_o
+3  A: 

If you're trying to copy code from a working project, then that code must already have a reference to Microsoft.Practices.EnterpriseLibrary.Data. Find the reference in Visual Studio and look at its properties.

Jon Skeet
I must really be doing something wrong. I dont even see it listed in the other project :/
0_o
Check references in your project. If it id listed there, right click to see properties which should give you the path from where the assembly is referenced.
Vinay B R
I did. The only Microsoft references I saw were Microsoft.JScript and Microsoft.Web.Preview. Unless I am checking the references the wrong way (right clicking on the old project->Property Pages->References), I really dont know whats going on.
0_o
@0_o: For most projects I don't right-click, I just expand the "References" node... what sort of project is this, and what version of Visual Studio are you using?
Jon Skeet
One of the projects was a web site. With your comment about expanding the References node, I started looking at other nodes and found the library under the bin folder. Everything works now :)
0_o