M
Mitchell Freeman
I am having a problem accessing/sharing classes/objects between projects
contained within a single solution. I was under the impression that
namespaces was the answer I was looking for, but it seems I am not getting
anywhere with it and I hope I can get a little help. I've browsed the
on-line docs and the MSKB as much as I can, but I cannot seem to get what I
think should work to actually work. I am using VS.net 2003 Enterprise
Edition, and am working in C# exclusively at this point.
This is a rough pseudo-code representation of what I have:
Solution "A"
Project "B"
namespace X
public class1
public class2
public class3
Project "C"
using X; (tried both with and without this line, no difference.)
namespace X (I want all these to be in the same namespace if
possible, but they don't HAVE to be)
public class4
...
class1 ObjName1 = new class1(); // I want to use the class1
classes defined in
class2 ObjName2 = new class2(); // project B here in project
C.
...
The problem occurs when I compile Project C. I get an error on both of the
lines above (in class4) that tells me "The type or namespace name 'class1'
does not exist in the class or namespace 'RESTS' (are you missing an
assembly reference?)". I get the same error for class2 (no big shock there).
I have tried coding the lines like "X.class1 ObjName1 = new X.class1();" and
I have tried doing different namespaces between the projects (X and Y), but
none of those seemed to either work or even give me anything other than the
same error message. I have also looked for a global solution-wide NAMESPACE
field in the project/solution properties, as well as where to add something
to either of the projects to make it seen by the others. Even according to
the on-line documentation about
I have to imagine that what I am attempting to do is not impossible (or is
it) and that I am just missing some significant yet small and simple step to
make it work. What lunacy am I self-inflicting on my solution? Could someone
please point me in the right direction? It would be most appreciated.
contained within a single solution. I was under the impression that
namespaces was the answer I was looking for, but it seems I am not getting
anywhere with it and I hope I can get a little help. I've browsed the
on-line docs and the MSKB as much as I can, but I cannot seem to get what I
think should work to actually work. I am using VS.net 2003 Enterprise
Edition, and am working in C# exclusively at this point.
This is a rough pseudo-code representation of what I have:
Solution "A"
Project "B"
namespace X
public class1
public class2
public class3
Project "C"
using X; (tried both with and without this line, no difference.)
namespace X (I want all these to be in the same namespace if
possible, but they don't HAVE to be)
public class4
...
class1 ObjName1 = new class1(); // I want to use the class1
classes defined in
class2 ObjName2 = new class2(); // project B here in project
C.
...
The problem occurs when I compile Project C. I get an error on both of the
lines above (in class4) that tells me "The type or namespace name 'class1'
does not exist in the class or namespace 'RESTS' (are you missing an
assembly reference?)". I get the same error for class2 (no big shock there).
I have tried coding the lines like "X.class1 ObjName1 = new X.class1();" and
I have tried doing different namespaces between the projects (X and Y), but
none of those seemed to either work or even give me anything other than the
same error message. I have also looked for a global solution-wide NAMESPACE
field in the project/solution properties, as well as where to add something
to either of the projects to make it seen by the others. Even according to
the on-line documentation about
I have to imagine that what I am attempting to do is not impossible (or is
it) and that I am just missing some significant yet small and simple step to
make it work. What lunacy am I self-inflicting on my solution? Could someone
please point me in the right direction? It would be most appreciated.