不能使用外部refernces用C#控制台应用程序 [英] Cannot use external refernces with C# Console Application

查看:169
本文介绍了不能使用外部refernces用C#控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我已经尝试下面的所有建议,但仍然没有喜悦。

Ok I have tried all the suggestions below but still no joy.

即时通讯正试图一个控制台应用程序,让我解释做什么的IM。

im now trying a console application, and let me explain exactly what im doing.


  1. 创建于2010年VS一个新的控制台项目

  2. 我添加了一些引用(DLL的)一些不是我的,如Castle.Winsor和N2 CMS的dll

  3. 在控制台应用程序,我可以添加using语句说明我使用的DLL引用内部命名空间

  4. 我开始编写代码。

  5. 当我编译使用引用的DLL立即用类型或命名空间名称'抱怨的所有代码不能(是否缺少using指令或程序集引用?)

  1. I create a new console project in VS 2010
  2. I add a number of references (dll's) some that aren't mine such as Castle.Winsor and N2 CMS dlls
  3. in the console app I can add using statements indicating I am using name spaces within the referenced DLLs
  4. I start writing code.
  5. As soon as I compile all the code that uses the referenced DLLs immediately complains with "The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)"

我已经尝试设置的dll总是复制到本地,我抄DLL到同一个目录,我曾尝试加入由项目引用并添加到DLL的本身

i have tried setting the dlls to copy to local always, I have copied the DLL into the same directory, i have tried added reference by project and adding a reference to the DLL's themselves

我不明白这个问题,网络应用程序项目或项目ASP.net他们总是做工精细,只有被编译为像一个控制台应用程序或Windows服务一个EXE的东西。

i don't get this problem with a web application project or a ASP.net project they always work fine, only something that is compiled to an EXE like a console app or windows service.

一定有什么东西我在想念或者我应该已经得到了这个工作。

there must be something im missing or I would have got this working by now.

Truegilly

Truegilly

推荐答案

项目目标更改为一个非客户端配置文件的目标。右键单击该项目并选择属性,你应该看到框架版本的列表。当你正在使用VS2010,控制台项目你已经默认目标的.NET Framework 4.0客户端配置文件创建的,该改到.NET Framework 4.0。

Change the project Target to a non Client Profile target. Right click the Project and select Properties, you should see a list of Framework versions. As you are using VS2010, the Console project you've created by default targets .NET Framework 4.0 Client Profile, change that to .NET Framework 4.0.

这篇关于不能使用外部refernces用C#控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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