Type.GetType and referred assemblies

Problem Statement:

There is a DLL called CommonAssembly. This contains a namespace called CommonNamespace. This namespace contains a class called CommonClass.

Another project adds a reference to CommonAssembly and wants to get the type of CommonClass using the method Type.GetType.

Additional Information:

// This statement won’t work.

// This will not work either

Since CommonClass type is defined in a referred assembly, Type.GetType will not be able to get the required type.


Type.GetType(“CommonNamespace.CommonClass, CommonAssembly”);

Anything that is given after the comma (“,”) is taken as the assembly name. This assembly is searched for the given type name.

If the required class is not encapsulated in any namespace, then omit the namespace name.

Type.GetType(“CommonClass, CommonAssembly”);

If this doesn’t work, then try giving the fully qualified name of the assembly.


19 thoughts on “Type.GetType and referred assemblies

  1. ManuelFelicio says:

    You just saved my day!

  2. ManuelFelicio says:

    It doesnt work..

  3. anaamica says:

    Make sure you have given the correct qualified name. It should work.

  4. EZElmo says:

    Type.GetType(”CommonClass”, CommonAssembly);

    should be

    Type.GetType(”CommonClass, CommonAssembly”);

    It’s right in the explaination….
    “Anything that is given after the comma (”,”) is taken as the assembly name.”
    Just not the example….

  5. anaamica says:

    Oops, thanks for pointing it out, EzElmo.

  6. Alan says:

    You can use:


    to get the right string name to put in to Type.GetType()

  7. Garcia says:

    Parabéns pelo Post!
    Salvou minha noite…

  8. Hamed says:

    I Saved my Job.
    I Love You.

  9. VinhPhat says:

    Thanks you very much!

    you saved my life… I love U

  10. masadjie says:

    Thanks. It works fine in my visual studio 2008.

  11. Mirko says:

    And if the xxx.dll assembly isn’t on root workspace? this works fine only if the xxx.dll is in the same directory of the executable..

  12. Ajmal Mohamed says:

    thanks. Its helped me too.

  13. ivan says:

    thanx worked perfectly! 5 stars.

  14. Mukesh Yadav says:

    Great !! I was facing this issue since last two days.

  15. staff0rd says:

    helped me, thanks alot

  16. Just face palmed myself! Pretty obvious looking at it NOW 🙂


  17. Ricardo says:

    Fantastic, thanks for this!!

  18. […] how do you request a Type check against the calling Assembly?  I found this:  https://generally.wordpress.com/2007/06/01/typegettype-and-referred-assemblies/. Which accurately describes how to dictate the Assembly to search for the […]

  19. I like the helpful info you provide in your posts. I will bookmark your blog and check again here frequently. I’m quite sure I’ll learn many new stuff right here! Good luck for the next!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: