I used the runtime.win-x64.Microsoft.NETCore.ILAsm nuget to get ilasm.exe to compile my CIL codes. It compiles everything correctly for the windows .exe PE, but apparently it doesn't compile for Linux and MacOS...
I know that using .NET 5.0 or newer with the dotnet --runtime command is able to compile for any supported OS. How to do this using CIL instead of C#? I thought it was using ilasm.exe, but apparently it's not possible, so what would be the solution for that?
Note: I already used the linux ilasm and the code compiled on linux was a .exe PE, an extension and format that doesn't work on linux (linux uses ELF format)
In order to compile MSIL I use following template:
ProjectName.ilprojcontent:Program.ilcontent:This setup allows me to compile programs without any problems. Commands
dotnet build -r linux-x64 --self-contained -c releaseanddotnet build -r win-x64 --self-contained -c releaseseems to work and produce some platform-specific output