问题描述
我有三个组件的C#控制台应用程序:主
,通用
和工具
。
I have a C# console application with three assemblies: Main
, Common
and Utilities
.
在主
集的文件, Main.cs
,我也行:使用公用
In a file in the Main
assembly, Main.cs
, I have the line:
using Utilities;
在通用
组件内的目录,我有DLL IBM.Data.DB2.dll
。
In a directory within the Common
assembly, I have the DLL IBM.Data.DB2.dll
.
在工具
集会,我有一个源模块,访问所述DLL。
公用事业具有参考的IBM.Data.DB2
。
在此组件内的源文件, Util.cs
,我也行:
In the Utilities
assembly, I have a source module which accesses said dll.Utilities has 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 );
我得到一个错误编译主
组装说明该命名空间名称工具
无法找到。 工具
编译细带或不带线。如果我注释掉上面的行,一切编译罚款。
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框架4客户端配置文件的目标框架。此更改为.NET框架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使得这次大会无法使用我的解决方案的其它部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!