开发者

Assembly instance with no types in it

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

var assembly = typeof (SomeType).Assembly; --> but without having to开发者_JAVA技巧 spacify any type?

Something like Assembly.Get("AssemblyName");


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜