参考IBM.Data.DB2中的代码使得该程序集不可用于我的解决方案的其余部分 [英] Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution
问题描述
Main
, Common
和
。 在主要
程序集中的文件中, Main.cs
,我有一行:
using Utilities;
在 Common
程序集中的目录中,我有DLL IBM.Data.DB2.dll
。
在实用程序
汇编,我有一个源模块访问所述 dll 。
实用程序具有对 IBM.Data.DB2
的引用。
在本程序集的源文件中, Util.cs
,我有这样一行:
使用IBM.Data.DB2;
如果在此文件的方法内,我对DB2程序集中的代码进行了任何引用, in:
DbConnection c = new DB2Connection(_connectString);
我收到错误编译 Main
表示找不到命名空间名称实用程序
。 实用程序
可以使用或不使用行编译。如果我注意到上面的一行,一切都编译得很好。
有用的同事来了,在五秒钟内解决了这个问题。
默认情况下,当在VS 2010中创建新的控制台应用程序时,它将获得.NET Framework 4客户端配置文件的目标框架。将此更改为.NET Framework 4使问题消失。
I have a C# console application with three assemblies: Main
, Common
and Utilities
.
In a file in the Main
assembly, Main.cs
, I have the line:
using Utilities;
In a directory within the Common
assembly, I have the DLL IBM.Data.DB2.dll
.
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;
If, within a method in this file, I make any reference to code within the DB2 assembly, as in:
DbConnection c = new DB2Connection( _connectString );
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.
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中的代码使得该程序集不可用于我的解决方案的其余部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!