views:

72

answers:

2

How do I get Assembly reference for a .dll with no types in it?

var assembly = typeof (SomeType).Assembly; --> but without having to spacify any type?

Something like Assembly.Get("AssemblyName");

+3  A: 

You want Assembly.Load, Assembly.LoadFile or Assembly.LoadFrom. There are differences between each .

According to Suzanne Cook

LoadFrom() goes through Fusion and can be redirected to another assembly at a different path but with that same identity if one is already loaded in the LoadFrom context.

LoadFile() doesn't bind through Fusion at all - the loader just goes ahead and loads exactly* what the caller requested. It doesn't use either the Load or the LoadFrom context.

And she also has another good post here detailing smoe of the advantages and disadvantages.

Bob
A: 

You can use the Assembly.LoadFile or Assembly.Load methods

Grizzly