This topic has not yet been rated - Rate this topic

Assembly.LoadFile Method

Loads the contents of an assembly file.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Static member LoadFile(String) Loads the contents of an assembly file on the specified path.
Public method Static member LoadFile(String, Evidence) Obsolete. Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence.
Top
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Assembly.LoadFile locks the file

As the LoadFile method keeps a lock on the file through the lifetime of  the parent process, you might consider using the Load method as:

Assembly.Load(System.IO.File.ReadAllBytes(filePath));

HTH

Assembly.LoadFrom/LoadFile/Load(byte[]) prefers GAC
According to: http://blogs.msdn.com/b/junfeng/archive/2004/11/03/252033.aspx

Starting in Whidbey beta2, for Assembly.LoadFrom/LoadFile/Load(byte[]), if there is an assembly in GAC with exactly the same assembly identity, we will return the one in GAC.
ReflectionOnlyLoad and ReflectionOnlyLoadFrom APIs are not affected.