Question

I just downloaded and installed Microsoft Enterprise Library 5.0. I fired up VS 2010 to play with EL 5 and created a very simple console application. However, it would not compile. I got the following error:

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

I added Microsoft.Practices.EnterpriseLibrary.Common, Microsoft.Practices.EnterpriseLibrary.Data, and Microsoft.Practices.Unity references to my project.

Here's the simple code that refuses to compile.

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.Unity;

namespace EntLib
{
    class Program
    {
        static void Main(string[] args)
        {
            IUnityContainer container = new UnityContainer();
            container.AddNewExtension<EnterpriseLibraryCoreExtension>();
            var defaultDatabase = container.Resolve<Database>();
        }
    }
}

The error above complains about line #2 :

using Microsoft.Practices.EnterpriseLibrary.Data;

Someone probably will point out to a stupid mistake by me, but at the moment I fail to see it.

I tried to remove and add again Microsoft.Practices.EnterpriseLibrary.Data to refences but it didn't help.

Was it helpful?

Solution

I found my answer at this question. I changed target framework in my project to .NET Framework 4 from .NET Framework Client Profile.

OTHER TIPS

im suspecting that you are targeting a .NET client profile. When using the Microsoft.Practices.EnterpriseLibrary.Data assembly of EntLib 5.0, you are required to target the full .NET framework. Right click on your project, select Properties, and in the Applciation tab, select either .NET Framework 3.5 or .NET Framework 4.0 as value of the Target Framework property. This is a known issue in EntLib 5.0

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top