问题描述
我有一个包含三个程序集的 C# 控制台应用程序:Main、Common 和 Utilities.
I have a C# console application with three assemblies: Main, Common and Utilities.
在 Main 程序集的文件 Main.cs 中,我有一行:
In a file in the Main assembly, Main.cs, I have the line:
using Utilities;
在 Common 程序集中的目录中,我有 DLL IBM.Data.DB2.dll.
In a directory within the Common assembly, I have the DLL IBM.Data.DB2.dll.
在 Utilities 程序集中,我有一个源模块可以访问上述 dll.实用程序具有对 IBM.Data.DB2 的引用.在此程序集中的源文件 Util.cs 中,我有一行:
In the Utilities assembly, I have a source module which accesses said dll.
Utilities have a Reference to IBM.Data.DB2.
In a source file within this assembly, Util.cs, I have the line:
using IBM.Data.DB2;
如果在此文件中的某个方法中,我对 DB2 程序集中的代码进行了任何引用,如下所示:
If, within a method in this file, I make any reference to code within the DB2 assembly, as in:
DbConnection c = new DB2Connection( _connectString );
编译 Main 程序集时出现错误,指出找不到命名空间名称 Utilities.Utilities 无论有没有这条线都可以很好地编译.如果我注释掉上面的行,一切都编译得很好.
I get an error compiling the Main assembly stating that the namespace name Utilities can not be found. Utilities compiles fine with or without the line. If I comment out the above line, everything compiles fine.
推荐答案
一位乐于助人的同事过来帮我解决了这个问题,大约五秒钟.
A helpful colleague came by and solved this for me in about five seconds.
事实证明,默认情况下,当在 VS 2010 中创建新的控制台应用程序时,它会获得.NET Framework 4 Client Profile"的目标框架.将其更改为.NET Framework 4"即可解决问题.
Turns out that by default, when a new Console app is created in VS 2010, it gets a target framework of ".NET Framework 4 Client Profile". Changing this to ".NET Framework 4" made the problem go away.
这篇关于引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)