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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With