G
Guest
Hi,
I think there is a bug in VS 2003 as well as VS 2005 C# compiler. Let me
explain:
I have created 3 projects in my solution:
ClassLibrary1, ClassLibrary2 and ClassLibrary3.
Now each of these libraries has a single public class in it (classes r named
as A, B and C respectively) and the class defined in 2nd library is derived
from the class in first library as:
************
//in ClassLibrary1
public class A
{
//constructor
}
//in ClassLibrary2
using ClassLibrary1;
public class B : A
{
//public constructor
}
//in ClassLibrary2
using ClassLibrary2;
public class C : A
{
//public constructor
public C()
{
B b1 = new B();
}
}
Here, ClassLibrary1 is referenced in project ClassLibrary2 and ClassLibrary2
is referenced in project ClassLibrary3.
Also, Class C defined in ClassLibrary3 is using an object of B in it.
But when i compile this code, i get an error saying:
e:\ClassLibrary3\bin\Debug\ClassLibrary2.dll Referenced class
'ClassLibrary2.B' has base class or interface 'ClassLibrary1.A' defined in an
assembly that is
not referenced. You must add a reference to assembly 'ClassLibrary1'.
According to me, we dont need to reference ClassLibrary1 as it is already
being referenced by ClassLibrary2 so this should compile fine. But i may be
wrong.
I owuld be grateful if someone could shed light on this.
Thanks
Vivek
I think there is a bug in VS 2003 as well as VS 2005 C# compiler. Let me
explain:
I have created 3 projects in my solution:
ClassLibrary1, ClassLibrary2 and ClassLibrary3.
Now each of these libraries has a single public class in it (classes r named
as A, B and C respectively) and the class defined in 2nd library is derived
from the class in first library as:
************
//in ClassLibrary1
public class A
{
//constructor
}
//in ClassLibrary2
using ClassLibrary1;
public class B : A
{
//public constructor
}
//in ClassLibrary2
using ClassLibrary2;
public class C : A
{
//public constructor
public C()
{
B b1 = new B();
}
}
Here, ClassLibrary1 is referenced in project ClassLibrary2 and ClassLibrary2
is referenced in project ClassLibrary3.
Also, Class C defined in ClassLibrary3 is using an object of B in it.
But when i compile this code, i get an error saying:
e:\ClassLibrary3\bin\Debug\ClassLibrary2.dll Referenced class
'ClassLibrary2.B' has base class or interface 'ClassLibrary1.A' defined in an
assembly that is
not referenced. You must add a reference to assembly 'ClassLibrary1'.
According to me, we dont need to reference ClassLibrary1 as it is already
being referenced by ClassLibrary2 so this should compile fine. But i may be
wrong.
I owuld be grateful if someone could shed light on this.
Thanks
Vivek