2 years ago

#70481

test-img

Hiep

Assembly.LoadFrom("Newtonsoft.Json.dll") could not load file

my launcher application (.NET5) uses Assembly.LoadFrom("totoPlugin.dll") to load and run a plugin "toto".

The "totoPlugin" depends on Newtonsoft.Json.dll, so I'd like the launcher to load the Newtonsoft.Json.dll as well. But when the launcher execute the

Assembly.LoadFrom("Newtonsoft.Json.dll") 

then it crashed

enter image description here

my actual workaround is to install the Newtonsoft nuget in the launcher project.. so that the plugin toto would work. But it is not a good solution.

  • Do you know what happened? why couldn't we load the Newtonsoft assembly? The path is correct, Assembly.LoadForm detected the version of the Newtonsoft.Json.dll, it just could not "LoadFrom" it, and the error message is not very helpful. enter image description here

  • what is a good way for my launcher application to be able to load an assembly (plugin) which depends on other assembly?

c#

.net-assembly

.net-5

0 Answers

Your Answer

Accepted video resources