vendredi 27 décembre 2019

Dynamically Load Type when self-contained publishing

I've got a Dotnet core 3.1 application that dynamically loads assemblies/types via reflection. Simply:

Type.GetType("namespace.my.class, myassembly")

has worked perfectly for a long time. We're updating to Core 3.1, and instead of installing the runtime on every machine, we'd like to deploy using the --self-contained flag. But, when we do this and load an object in a 3rd party using Type.GetType, we always get back null, meaning that it couldn't find it.

After much pain, I found that it's because the 3rd party assembly, and it's dependencies, aren't listed in the deps.json file. I'd rather not have to manually add the 3rd party assembly to the deps.json file, is there a way to make the application load these assemblies at runtime? It may or may not matter, but the 3rd party assemblies have dependencies of their own.





Aucun commentaire:

Enregistrer un commentaire