无法引用大会的后使用的命名空间 [英] Unable to use namespace after referencing assemblys

查看:110
本文介绍了无法引用大会的后使用的命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,

我有一个C#的问题,多项目在Visual Studio解决方案2010 SP1。

I am having a problem with a c#, multi-project solution in Visual Studio 2010 SP1.

下面是解的结构: BNLib - 公用事业艾米个人图书馆 WidgetClientApp - 在asp.net应用程序前端 WidgetConsoleUtilities - 控制台应用程序 WidgetCore - 包含共享接口,类和枚举 WidgetMiddleTier - 经营业务逻辑 WidgetDataLayer - DB通过LINQ访问SQL

Here is the Solution Structure: BNLib - amy personal library of utilities WidgetClientApp - The asp.net application front end WidgetConsoleUtilities - A console application WidgetCore - contains shared interfaces, classes and enums WidgetMiddleTier - Bussiness logic WidgetDataLayer - DB access via linq to SQL.

问题 添加引用到中间层组件(WidgetMiddleTier,其中包含命名空间Widget.MT)的控制台应用程序(WidgetConsoleUtilities)后,我添加了一个using指令到我的Program.cs页:

The problem After adding a reference to the middle tier assembly (WidgetMiddleTier, which contains namespace Widget.MT) to the console application (WidgetConsoleUtilities), I added a using directive to my program.cs page:

使用Widget.MT;

using Widget.MT;

然后我收到using指令编​​译器错误:

I then receive a compiler error on the using directive:

中的类型或命名空间名称MT没有命名空间窗口小部件(是否缺少程序集引用?)存在

The type or namespace name 'MT' does not exist in the namespace 'Widget' (are you missing an assembly reference?)

我使用该组件在同一个解决方案其他几个项目没有问题。 我用的控制台应用程序的另一个组件(WidgetCore,其中包含命名空间Widget.Core)没有困难。

I use this assembly in several other projects in the same solution without a problem. I use another assembly (WidgetCore, which contains namespace Widget.Core) in the console application without difficulty.

Web应用程序(窗口小部件)使用这两个组件没有问题。

A web application (Widget) uses both these assemblies without issue.

我已经试过removeing​​和readding的命名空间,关闭并重新打开Visual Studio 2010中,清洁建立,包括直接组件,而不是项目,nothng工作过。

I have tried removeing and readding the namespaces, closing and reopening Visual studio 2010, cleaning the builds, directly including assemblies instead of projects, and nothng has worked.

任何想法?

您的帮助将不胜apperciated!

Your help will be greatly apperciated!

最好的,

布雷特

推荐答案

是使用控制台应用程序。一次偶然的机会的NET 4客户端配置文件?如果是这样,你不能引用程序集是不是在.NET Framework 4客户端配置文件。相反,你必须面向.NET Framework 4 - 要做到这一点去你的项目属性和目标框架更改为.NET Framework 4的

Is the console application using the .NET 4 client profile by chance? If so you cannot reference an assembly that is not in the .NET Framework 4 Client Profile. Instead you must target the .NET Framework 4 - to do this go to your project properties and change the "Target Framework" to ".NET Framework 4".

这篇关于无法引用大会的后使用的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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