Skip to content

Commit bb7bf21

Browse files
scottlerchclaude
andauthored
Pin NativeAOT ILCompiler to 10.0.10 to match the installed .NET 10 runtime (#137)
The .NET SDK 10.0.302 still defaults the NativeAOT compiler to 10.0.9, but the self-contained runtime pack now resolves to 10.0.10 (a newer .NET 10 servicing runtime). AOT publish then fails with "Overriding System.Private.CoreLib.dll with a newer version is not supported" for every AOT project (Elevate, Cli, WinUI). Align the compiler up to the runtime by pinning Microsoft.DotNet.ILCompiler to 10.0.10 in the three AOT projects. This only affects `dotnet publish` (release builds); CI does `dotnet build`/`dotnet test`, which never invokes ILC, so the reference is inert there. Bump alongside the runtime; remove once the SDK default catches up. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 09aa074 commit bb7bf21

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

HostsFileEditor.Cli/HostsFileEditor.Cli.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
<ItemGroup>
1919
<ProjectReference Include="..\HostsFileEditor.Core\HostsFileEditor.Core.csproj" />
2020
</ItemGroup>
21+
<ItemGroup>
22+
<!-- Pin the NativeAOT ILCompiler to match the installed .NET 10 runtime (10.0.10); see the
23+
same note in HostsFileEditor.Elevate.csproj. Remove once the SDK default catches up. -->
24+
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="10.0.10" />
25+
</ItemGroup>
2126
</Project>

HostsFileEditor.Elevate/HostsFileEditor.Elevate.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,12 @@
1818
<PublishAot>true</PublishAot>
1919
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
2020
</PropertyGroup>
21+
<ItemGroup>
22+
<!-- Pin the NativeAOT ILCompiler to match the installed .NET 10 runtime (10.0.10). The .NET SDK
23+
10.0.302 still defaults the AOT compiler to 10.0.9, which conflicts with the newer 10.0.10
24+
self-contained runtime pack ("Overriding System.Private.CoreLib.dll with a newer version is
25+
not supported"). Aligning the compiler up to the runtime fixes AOT publish. Bump alongside
26+
the runtime; remove once the SDK default catches up. -->
27+
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="10.0.10" />
28+
</ItemGroup>
2129
</Project>

HostsFileEditor.WinUI/HostsFileEditor.WinUI.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
<ItemGroup>
6262
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.9" />
6363
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.2.0" />
64+
<!-- Pin the NativeAOT ILCompiler to match the installed .NET 10 runtime (10.0.10); see the same
65+
note in HostsFileEditor.Elevate.csproj. The SDK 10.0.302 default (10.0.9) conflicts with the
66+
newer 10.0.10 self-contained runtime pack. Remove once the SDK default catches up. -->
67+
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="10.0.10" />
6468
<PackageReference Include="H.NotifyIcon.WinUI" Version="2.4.1" />
6569
<PackageReference Include="System.Resources.Extensions" Version="10.0.9" />
6670
<!-- Taskbar Jump List (issue #10) uses the WinRT Windows.UI.StartScreen.JumpList API — packaged-

0 commit comments

Comments
 (0)