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)
Note: The .Net Standard project is referenced in a Winforms .net Framework 4.7.2 Project, and I have added the System.Runtime.Loader 4.3.0 from Nuget into the Winforms Application also (although it just adds the reference to it in packages.config, and I cannot see any Package or any Reference to System.Runtime.Loader in the Winforms Project)
User contributions licensed under CC BY-SA 3.0