dimanche 24 novembre 2019

Why is there this Error for System.Runtime.Loader in a .Net Standard Library Project - "....Can only be loaded in the Reflection-only loader context."

I have System.Runtime.Loader 4.3.0 from Nuget into my .Net Standard 2.0 Library project, and I am using this Code,

AssemblyName assemblyNameObject = new AssemblyName(assemblyName);
var myAssembly = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyName(assemblyNameObject);

The Method which contains the above Code DOES NOT get called at all.

And this error is shown,

Could not load file or assembly System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)




Aucun commentaire:

Enregistrer un commentaire