B
Bob
For an assembly I manually load from a file, this code snippet:
For Each t As Type In asm.GetTypes
'do something
Next
generates this error message:
System.Reflection.ReflectionTypeLoadException: One or more of the types in the
assembly unable to load.
at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at ....
So I thought, fine, before calling GetTypes I can manually load the referenced
assemblies because I already know where they are.
For Each refasmname As AssemblyName In asm.GetReferencedAssemblies
Try
Dim asmtoload As String = DirectoryLocation & refasmname.Name & ".dll"
asm.LoadFrom(asmtoload)
Catch
End Try
Next
Even if all referenced assemblies are found and loaded, though, this technique
doesn't work all the time and I'm not quite sure why. Is there some way I can
say, "hey, you, assembly! - go look *here* to resolve references you can't
find"?
thanks in advance for any help,
Bob
P.S. Using the GAC is not an option.
For Each t As Type In asm.GetTypes
'do something
Next
generates this error message:
System.Reflection.ReflectionTypeLoadException: One or more of the types in the
assembly unable to load.
at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at ....
So I thought, fine, before calling GetTypes I can manually load the referenced
assemblies because I already know where they are.
For Each refasmname As AssemblyName In asm.GetReferencedAssemblies
Try
Dim asmtoload As String = DirectoryLocation & refasmname.Name & ".dll"
asm.LoadFrom(asmtoload)
Catch
End Try
Next
Even if all referenced assemblies are found and loaded, though, this technique
doesn't work all the time and I'm not quite sure why. Is there some way I can
say, "hey, you, assembly! - go look *here* to resolve references you can't
find"?
thanks in advance for any help,
Bob
P.S. Using the GAC is not an option.