Shouldn't this compile?

  • Thread starter Thread starter Robin
  • Start date Start date
R

Robin

I have 1 solution with two projects…

This code is in a Console Application project named: Name1.Name2

namespace Name1.Name2 {
public class Class1 {
public static void Main(string[] args) {
Name1.Name2.Name3.Class2 x = new
Name1.Name2.Name3.Class2();
}
}
}


This code is in a Class Library project named: Name1.Name2.Name3

namespace Name1.Name2.Name3 {
public class Class2 {
}
}

When running VS.NET 2003 on Win2k I get the following error message:

Class1.cs(4): The type or namespace name 'Name3' does not exist in the
class or namespace 'Name1.Name2' (are you missing an assembly
reference?)

Thanks in advance for any help!

Robin
 
Robin said:
I have 1 solution with two projects?

And do you have a reference from the project containing Class1 to the
project containing Class2?

<snip>
 
You need to reference the application assembly to the class library
assembly. Assuming they are in the same solution (both projects), in the
"References" folder in the console application project, add a reference,
choose the "Project" (or "Solution", can't rememeber) tab, and you should be
able to find the Name1.Name2.Name3.dll which the class library creates.

If they are not in the same solution, the same method applies, but you
should browse for the DLL and it won't be automatically found by the IDE,
unless it's in the GAC.

Javier Campos
Virtual Media Systems, S.L.
 
Back
Top