Enterprise Library 5.0 -The type or namespace name 'Data' does not exist in the namespace 'Microsoft.Practices.EnterpriseLibrary

Apr 18, 2010 at 12:51 PM

Hi,

I have downloaded the source code from below location - http://entlib.codeplex.com/SourceControl/list/changesets/65503 as mentioned in the Grigori -blog.  I have recompiled the solution and copied the binaries in shared location to be used by the project team.

When we try to add reference to the Microsoft.Practices.EnterpriseLibrary.Data and build our project it gives the following error

Error 2 The type or namespace name 'Data' does not exist in the namespace 'Microsoft.Practices.EnterpriseLibrary' (are you missing an assembly reference?)

Please advice

Thanks

Subu

Apr 19, 2010 at 1:27 AM

The namespace didn't changed and I wasn't able to repro your error.  Are there any other build errors?  If yes, you just probably need to resolve those in order to get past this one.  

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@Avanade.com

Apr 19, 2010 at 4:07 AM

Hi,

Thanks for your quick reply. Unfortunately this error happens to me!

I am able to successfully recompile EnterpriseLibrary.2010.sln and using the dlls created under bin folder. this happens only when i add reference to Microsoft.Practices.EnterpriseLibrary.Data;

I am currently using VS2010 Ultimate. Are there are any dependancies which i need to take care before doing this.

Please help us out.

 

Thanks

Subu

 

 

 

Apr 19, 2010 at 4:30 AM

The error message what i am getting is

 

------ Build started: Project: Common.2010, Configuration: Debug Any CPU ------  Common.2010 -> C:\Projects\entlib-65503\Blocks\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Common.dll------ Build started: Project: Data.2010, Configuration: Debug Any CPU ------  Data.2010 -> C:\Projects\entlib-65503\Blocks\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Data.dll------

Build started: Project: WindowsFormsApplication1, Configuration: Debug Any CPU ------

C:\Projects\entlib-65503\Blocks\WindowsFormsApplication1\Form1.cs(9,45): error CS0234: The type or namespace name 'Data' does not exist in the namespace 'Microsoft.Practices.EnterpriseLibrary' (are you missing an assembly reference?)
Compile complete -- 1 errors, 0 warningsC:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3253: The referenced assembly "C:\Projects\entlib-65503\Blocks\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Data.dll" could not be resolved because it has a dependency on "System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.========== Build: 2 succeeded or up-to-date, 1 failed, 0 skipped ==========

 

Apr 19, 2010 at 4:33 AM

Are there any other build errors in your project aside from the one you mentioned?  Another thing, you said that this error happens to you? Does that mean it only happens on your machine and not on the others?  Doesn't the Microsoft.Practices.EnterpriseLibrary.Data assembly (from the list of the project references) shows a yellow icon indicating that that reference cannot be resolved?

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@Avanade.com

Apr 19, 2010 at 4:45 AM

Hi,

Thanks for your quick response.

 

Actually i was able to resolve this by reading BCL Team blog. for the client applications (web or windows), In the project properties >> Application >> Target framework >> by default .NET Framework 4 Client profile is selected which should be changed to .NET Framework and recompile, it worked.

http://blogs.msdn.com/bclteam/archive/2008/05/21/net-framework-client-profile-justin-van-patten.aspx

Thanks

Subu

Apr 19, 2010 at 7:07 AM

Thanks for sharing this info to the community.

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@Avanade.com

May 4, 2010 at 8:17 PM

Windows 7, VS 2010 Professional Beta 2

When I reference to Microsoft.Practices.EnterpriseLibrary.Data.dll and I run the application. It does not recognize Microsoft.Practices.EnterpriseLibrary.Data.

I even recompiled the enterprise solotion project and referenced to the newly build Microsoft.Practices.EnterpriseLibrary.Data.dll.

But it still does not reference correctly.

Is there going to be a fix for this?

Thanks

Jos

May 4, 2010 at 11:28 PM

Change the target platform for your project from ".NET 4.0 Client Profile" to ".NET 4.0 Framework." Data has dependencies on some stuff that isn't included in the client profile.

 

Jun 29, 2010 at 7:27 PM
Edited Jun 29, 2010 at 7:30 PM

I am having the same issue with Enterprise library 4.1.  I tried switching to the full framework and it still does not work.  I wasn't sure if it is a Visual Studio 2010 issue or Enterprise Library Issue (because it does work in Visual Studio 2008 correctly) so I also placed a ticket here:  https://connect.microsoft.com/VisualStudio/feedback/details/571706/visual-studio-2010-will-not-allow-import-of-microsoft-enterprise-library-4-1-data-access-application-block-in-any-windows-applications

 Edit: I also wanted to note I'm using Visual Studio 2010 Premium and working on a Windows app (web apps work fine).  I've tried WPF apps and Windows Forms apps and neither will compile.  Even after changing the target platform and recompiling I still had no luck.  Also, looking at the project references shows that the reference is there.

Jul 1, 2010 at 7:36 AM

I believe EntLib 4.1 is officially not supported on .NET 4.0, see Chris Tavares' reply on this.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Aug 30, 2010 at 3:57 AM

Thanks!! I was able to resolve by changing the target platform for your project from ".NET 4.0 Client Profile" to ".NET 4.0 Framework." -- I guess if Data has some dependencies that isn't included in the client profile then the documentation should mention that or may be at least add that now onwards.

Sep 17, 2010 at 3:38 AM

Change the target platform for your project from ".NET 4.0 Client Profile" to ".NET 4.0 Framework." Data has dependencies on some stuff that isn't included in the client profile.

 

this is the right answer.

 

thank you for ctavares and subramaniyanan.

Jan 27, 2012 at 6:50 AM

This is useful. Thanks subramaniyanan for the answer