ikvmnet / ikvm

A Java Virtual Machine and Bytecode-to-IL Converter for .NET
Other
1.28k stars 121 forks source link

Multiple RuntimeIdentifiers targeting more than selected .NET 8.0 #621

Closed mtmulch0191 closed 1 day ago

mtmulch0191 commented 2 days ago

I have the following configuration in my API's main .csproj. So I want to target win-x64 and win-x86 but when I publish the project I get the entire target set from IKVM. image image

However if I change <RuntimeIdentifiers> to <RuntimeIdentifier> and target a singular RID it will only output the win-x64. image image

I have to confirm our need for x64 and x86 but I believe x64 should sufficient but I wanted to report this for the project.

wasabii commented 2 days ago

What command are you using to publish?

mtmulch0191 commented 2 days ago

I am using dotnet publish and I also tried publishing to a local folder with Visual Studio.

wasabii commented 2 days ago

Try specifying a RID when you publish. Else you are publishing a runtime dependent image.

The RuntimeIdentifiers item group doesn't change that.

wasabii commented 2 days ago

https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifiers

The RuntimeIdentifiers property lets you specify a semicolon-delimited list of runtime identifiers (RIDs) for the project. Use this property if you need to publish for multiple runtimes. RuntimeIdentifiers is used at restore time to ensure the right assets are in the graph.

mtmulch0191 commented 2 days ago

I was able to get this to work locally on my machine with dotnet publish -r win-x64 --self-contained. I have some runtime dependencies issues that need to be resolve locally but even with --self-contained my bundle size is drastically smaller due to IKVM targets not being available and the ASP .NET Core runtimes folder.

It would make sense that if I wanted to publish for x86 I would run another publish command for -r win-x86.