ASP.Net: Assembly.LoadFrom V/S Assembly.LoadFile

Both methods are used to load the assemblies. we can then extract all the metatdata of the assembly using Reflection but there are some differences between both of them:

Assembly.LoadFrom()

Assembly.LoadFile()

·         LoadFrom() can use either the name or the path of the assembly, It uses a probing algorithm to find the assembly if, you have two assemblies that have the same identity but different locations, you can get some unexpected behavior.

·         LoadFile() will expect the path of the assembly by using LoadFile(), you can load the desired assembly as needed.

 

·         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.

 

Ebook Download
View all
Learn
View all
F11Research & Development, LLC