I have an assembly that was dynamically generated using AssemblyBuilder.DefineDynamicAssembly
, yet when i try to load it, i get the following error:
System.IO.FileNotFoundException: 'Could not load file or assembly 'test, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'
This is the full code to reproduce:
var name = new AssemblyName("test");
var assembly = AssemblyBuilder.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
var assembly2 = Assembly.Load(name);
I am using .NET Core 2.0, 2.1 and 2.2.
Can somebody please explain why this happens and any possible solutions?