简单的企业图书馆的控制台应用程序拒绝编译 [英] Simple Enterprise Library console application refuses to compile

查看:132
本文介绍了简单的企业图书馆的控制台应用程序拒绝编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载并安装<一href="http://www.microsoft.com/downloads/details.aspx?FamilyId=bcb166f7-dd16-448b-a152-9845760d9b4c&displaylang=en"相对=nofollow>微软企业库5.0 。我启动了VS 2010与EL 5玩,创造了一个非常简单的控制台应用程序。但是,它不会编译。我得到了以下错误:

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:

的类型或命名空间名称数据不会在命名空间存在   Microsoft.P​​ractices.EnterpriseLibrary   (是否缺少程序集   参考?)

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

我加的 Microsoft.P​​ractices.EnterpriseLibrary.Common,Microsoft.P​​ractices.EnterpriseLibrary.Data Microsoft.P​​ractices.Unity 的 引用我的项目。

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

下面是简单的code表示拒绝编译。

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>();
        }
    }
}

上述错误抱怨行#2:

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.

我试图删除并重新Microsoft.P​​ractices.EnterpriseLibrary.Data添加到refences,但它并没有帮助。

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

推荐答案

我发现我在答案这个问题。我在我的项目变化的目标框架.NET Framework 4的从.NET框架的客户端配置文件。

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

这篇关于简单的企业图书馆的控制台应用程序拒绝编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆