G
Guest
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 InheritClassUser that uses the class in
namespace InheritClass.
The references/using are from InheritClass to BaseClass and from
InheritClassUser to InheritClass
Why does it give the error:
Error 1 The type 'BaseClass.MyBaseClass' 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\versuche\InheritanceReferenceProblem\InheritClassUser\MyInheritClassUser.cs 7 24 InheritClassUser
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 InheritClassUser
{
class MyInheritClassUser
{
MyInheritClass oMyInheritClass;
static void Main(string[] args)
{
}
}
}
This is strange, since from "intuition" MyInheritClassUser 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 InheritClassUser that uses the class in
namespace InheritClass.
The references/using are from InheritClass to BaseClass and from
InheritClassUser to InheritClass
Why does it give the error:
Error 1 The type 'BaseClass.MyBaseClass' 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\versuche\InheritanceReferenceProblem\InheritClassUser\MyInheritClassUser.cs 7 24 InheritClassUser
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 InheritClassUser
{
class MyInheritClassUser
{
MyInheritClass oMyInheritClass;
static void Main(string[] args)
{
}
}
}
This is strange, since from "intuition" MyInheritClassUser 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,