I need to get a list of assemblies in a Directory, Is there another way than this
System.IO.Directory.GetFiles(directory, "*.dll")
I need to get a list of assemblies in a Directory, Is there another way than this
System.IO.Directory.GetFiles(directory, "*.dll")
Managed assemblies can also be EXEs. And your code just gets files with the extension "dll". Ntive DLLs, which are not assemblies, would also be returned.
In the few occasions I needed to do this, I simply got a list of all files (similar to what you've done), and then used Assemby.LoadFrom to attempt to load each, trappig the exception in the event its native. The typical exception is a ReflectionTypeLoadException, though you also may get this if a reference can't be resolved.