Hi,
I have the following problem with VS 2005 (Professional) and C# 2.0
I will use assembly and namespace synonymously here.
I have a class in namespace InheritClass inherit from a baseclass in
namespace BaseClass.
Then I have a class in namespace InheritClassUse r that uses the class in
namespace InheritClass.
The references/using are from InheritClass to BaseClass and from
InheritClassUse r to InheritClass
Why does it give the error:
Error 1 The type 'BaseClass.MyBa seClass' is defined in an assembly that is
not referenced. You must add a reference to assembly 'BaseClass,
Version=1.0.0.0 , Culture=neutral ,
PublicKeyToken= null'. D:\SOURCE\versu che\Inheritance ReferenceProble m\InheritClassU ser\MyInheritCl assUser.cs 7 24 InheritClassUse r
The code is as follows:
One Solution with:
Project 1 (Class Library):
namespace BaseClass
{
public class MyBaseClass
{
public MyBaseClass()
{
}
}
}
Project 2 (Class Library):
using BaseClass;
namespace InheritClass
{
public class MyInheritClass: MyBaseClass
{
public MyInheritClass( ):base()
{
}
}
}
Project 3 (Console Application):
using InheritClass;
namespace InheritClassUse r
{
class MyInheritClassU ser
{
MyInheritClass oMyInheritClass ;
static void Main(string[] args)
{
}
}
}
This is strange, since from "intuition" MyInheritClassU ser should not need
to know about MyBaseClass.
Why does it need a reference?
The reference from InheritClass to BaseClass should be enough to "find"
BaseClass.
Regards,
I have the following problem with VS 2005 (Professional) and C# 2.0
I will use assembly and namespace synonymously here.
I have a class in namespace InheritClass inherit from a baseclass in
namespace BaseClass.
Then I have a class in namespace InheritClassUse r that uses the class in
namespace InheritClass.
The references/using are from InheritClass to BaseClass and from
InheritClassUse r to InheritClass
Why does it give the error:
Error 1 The type 'BaseClass.MyBa seClass' is defined in an assembly that is
not referenced. You must add a reference to assembly 'BaseClass,
Version=1.0.0.0 , Culture=neutral ,
PublicKeyToken= null'. D:\SOURCE\versu che\Inheritance ReferenceProble m\InheritClassU ser\MyInheritCl assUser.cs 7 24 InheritClassUse r
The code is as follows:
One Solution with:
Project 1 (Class Library):
namespace BaseClass
{
public class MyBaseClass
{
public MyBaseClass()
{
}
}
}
Project 2 (Class Library):
using BaseClass;
namespace InheritClass
{
public class MyInheritClass: MyBaseClass
{
public MyInheritClass( ):base()
{
}
}
}
Project 3 (Console Application):
using InheritClass;
namespace InheritClassUse r
{
class MyInheritClassU ser
{
MyInheritClass oMyInheritClass ;
static void Main(string[] args)
{
}
}
}
This is strange, since from "intuition" MyInheritClassU ser should not need
to know about MyBaseClass.
Why does it need a reference?
The reference from InheritClass to BaseClass should be enough to "find"
BaseClass.
Regards,
Comment