Lokad / ILPack

Serialize .NET Core assemblies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generated assembly from a .NET 5 executable is ".NETFramework" instead of ".NETCore"

frabert opened this issue · comments

Using this code from a .NET 5 app:

        var ab = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("test"), AssemblyBuilderAccess.Run);
        var mb = ab.DefineDynamicModule("test");
        var tb = mb.DefineType("Resources");
        var fb = tb.DefineInitializedData("Something", new byte[] { 1, 2, 3, 4, 5 }, FieldAttributes.Public | FieldAttributes.Static);

        tb.CreateType();

        var ag = new Lokad.ILPack.AssemblyGenerator();
        ag.GenerateAssembly(ab, "test.dll");

generates a .NETFramework-type library:
image
(Taken with ILSpy)

Is there a way to force ILPack to generate .NETCore binaries?

Hi @frabert, thanks for your interest. Actually, I am not sure how to control this part of the assembly generation, and I don't have the time to investigate. Don't hesitate to push a PR if you find out. Very sorry for not being more helpful.

Upon further investigation, this does not seem to cause issues when loading the resulting assembly from .NET Core / .NET 5 projects