Type.GetType(), GAC, strong names

L

lit

I want to use Type.GetType(typeName) for a class defined in an assembly
that will be in the GAC. I understand that I must provide strong name
information such as the KeyPair or versioninfo in the typeName string.

The Type that I am getting is statically referenced by other classes of
other assemblies that will be loaded into the appdomain. Therefore,
the strong name info should be dynamically available to me.

I want to be able to resolve that typeName without having to hard-code
the strong name info, or provide it via application configuration. Is
this possible?

I could also phrase the question this way: How can I determine the
strong name of an assembly that has been or will be loaded into the
Appdomain?

TIA,

Leo
 
M

Mattias Sjögren

I could also phrase the question this way: How can I determine the
strong name of an assembly that has been or will be loaded into the
Appdomain?

Well if the assembly is already loaded you can find it with it will be
in the AppDomain.GetAssemblies(). Once you found the Assembly instance
you're looking for you can simply call Assembly.GetType() and just
pass in the type name.

I don't see how you could reliably know which assemblies will be
loaded in the future.


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top