I have two .NET Core 3.0 WPF projects. One of them, I published into an executable called "DefaultPlugin.exe".
In my second WPF project, I'm trying to load the first project using Assembly.Load and read the types. However, when I do so, I get an exception, "Bad IL Format" from System.Private.CoreLib. It works when I load the DefaultPlugin.dll from the bin folder I also checked my CPU configuration to make sure they match.
///Works:
string path = @"C:\Users\S-D81\source\repos\DefaultPlugin\DefaultPlugin\bin\Debug\netcoreapp3.0\win-x64\DefaultPlugin.dll";
///Does not work:
//string path = @"C:\Users\S-D81\source\repos\DefaultPlugin\DefaultPlugin\bin\Debug\netcoreapp3.0\win-x64\DefaultPlugin.exe";
//string path = @"C:\Users\S-D81\source\repos\DefaultPlugin\DefaultPlugin\bin\Release\netcoreapp3.0\win-x64\publish\DefaultPlugin.exe";
Assembly assembly = Assembly.LoadFrom(path);
Is there a way to use Assembly.Load on a published .NET Core 3.0 assembly or is this just a limitation of the new framework?