[NativeAOT LLVM] Using together with .NET 8 SDK (original) (raw)
Troubleshooting of recent issue uncover fact that .NET 8 SDK is not supported.
So my current proposal is advocate following way of consuming NativeAOT-LLVM
<!-- This line needed only for wildcard consumption -->
<PackageReference Include="Microsoft.DotNet.ILCompiler.LLVM" Version="8.0.0-*" />
Now a bit about how that's working.
Detection of supported ILC package happens here by matching TFM with KnownILCompilerPack
https://github.com/dotnet/sdk/blob/d8b549b85299046654ba8e9bd0caff0eed507ae6/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs#L613-L618
and then added as implicit package references here
https://github.com/dotnet/sdk/blob/d8b549b85299046654ba8e9bd0caff0eed507ae6/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs#L690-L697
I initially thought that first place can be extended to perform ILC package selection based on the TFM + RID, but second place insert additioal reference on ILCompiler which causing issues.
So this led me to following solution where I remove existing KnownILCompilerPack and create new one in suited for NativeAOT-LLVM.
If dotnet/sdk#31398 lands then removal of existing ILCompiler does not needed.
I did not dig deeper why we cannot use NativeAOT-LLVM without PublishAot, maybe that would be more viable solution with less divergence from main.