Frage

I'm unable to reference certain types in a separate assembly. The strange thing is that, when I browse the referenced assembly in the object model, I can see the type I'm looking for there. But when I try to reference the type, the compiler gives me "the type or namespace name cannot be found".

More strange facts:

  • I can reference another type in the same assembly and namespace
  • I can reference the missing type from another assembly (an MVC project, the project in question is a C# Windows service)

Does anyone have an idea what might be going on?

UPDATE

I just noticed that if I remove the dependency library reference, them re-add it, the type references immediately resolve. But then, when I try to build the dependent project, it again says the references cannot be found.

Here are the classes

Dependency Library Project

namespace LibProject
{
    public class HelloWorld {}
}

Dependent Project

namespace MyProject
{
    public class HelloTest
    {
        LibProject.HelloWorld test;   // Type or namespace name could not be found
    }
}

END UPDATE

War es hilfreich?

Lösung

Which framework are you targeting? I had a similar problem once where the class wasn't in the Client Profile, but it was in the full framework (same version number, sans "Client Profile").

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top