I had an application under .Net framework 4.5 that would open an assembly from a file and return the tyes in it as an array which I could then work with.
I need to update that application to .Net 5 and when I call GetTypes or GetExportedTypes on it it throws a FileNotFoundException. I know that the reason is that there is an embedded dependancy within that dll but I don't mind ignoring any types that would be contained in that. I just need the types in the base dll. Anyway I can't seem to find any way to retrieve the types without hitting this exception and scoured google for the new proper way to do this but to no avail.
Here's a simplified block of code that used to work in .Net framework.
private bool CheckAssembly(FileInfo assemblyPath)
{
var asm = Assembly.LoadFrom(assemblyPath.FullName);
var types = asm.GetExportedTypes();
...
}
Aucun commentaire:
Enregistrer un commentaire