The type is defined in an assembly that is not referenced, how to find the cause?

When you get this error it isn’t always obvious what is going on, but as the error says – you are missing a reference. Take the following line of code as an example:

MyObjectType a = new MyObjectType("parameter");

It looks simple enough and you probably have referenced “MyObjectType” correctly. But lets say one of the overloads for the “MyObjectType” constructor takes a type that you don’t have referenced. For example there is an overload defined as:

public MyObjectType(TypeFromOtherAssembly parameter) {
    // ... normal constructor code ...
}

That is at least one case where you will get this error. So, look for this type of pattern where you have referenced the type but not all the types of the properties or method parameters that are possible for functions being called on that type.

Hopefully this at least gets you going in the right direction!

Leave a Comment