I have two projects in my solution and in each of them I have a CS file containing a public class. Since both classes are in the same namespace, I was expecting them to be able to see each other. That is not the case. See the setup below.
Project Woof1, file File.CS
namespace MyNameSpace
{
public class Foo
{
// Doesn't compile
Faa f;
}
}
Project Woof2, file File.CS
namespace MyNameSpace
{
public class Faa
{
// Doesn't compile
Foo f;
}
}
NB, both classes are stored in files with the same name but in different directories (i.e. not the same file).
- Why can’t I compile it?
- What can I do about it (except moving the classes to the same project).
(I only found this discussion on the subject but in the end it wasn’t really my issue.)
publicqualifier on all the classes in the projects.publicqualifier on all the enumerations in the projects.Also, preferably, you might want to move your
enums and other auxiliary definitions to a common project and store them there.