Reputation: 11597
I am getting a ReflectionTypeLoadException from the following code :
var myAssembly = Assembly.LoadFrom(myDLL);
var types = myAssembly.GetTypes())
myDLL references a class in another file in an other assembly ("myDependency.dll")
I made sure that this file resides in the application directory and also in the same folder as "myDLL" file.
How to be able to load myDLL properly in this case ?
Upvotes: 1
Views: 117
Reputation: 11597
Well I am proud to announce that I have spoiled my Friday night on some stupid "eye-persistence" phenomenon caused by Visual Studio 2010 (I guess). I Just Copied-Pasted my DependencyDLL project into a brand new assembly/project, deleted the old one, updated old reference to point to the new DependencyDLLNew, And Voilà : That did the trick. Problem solved. Thank to those who helped.
Upvotes: 0
Reputation: 18069
Make sure all your assemblies (dlls and exes included referenced assemblies) are up to date (platform, configuration and version/build date) and in your exe's directory.
Try deleting all the projects' OBJ and BIN directories prior to your build to help validate this.
Make sure you do not have other versions in the GAC or a directory in the %PATH%.
Upvotes: 1
Reputation: 1648
I'd try calling:
AssemblyName[] referenced = myAssembly.GetReferencedAssemblies();
then iterate over the AssemblyName objects and attempt to load those, prior to calling myAssembly.GetTypes()
Upvotes: 1