Skip to content

Don't bundle NativeAOT runtime assets in the ILCompiler package #116882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jkoritzinsky
Copy link
Member

With dotnet/sdk#46611, the .NET SDK will now use the "NativeAOT runtime pack" as the "runtime package" when publishing for NativeAOT. It's not as clean as dotnet/sdk#37872, but it has the same effect on our packaging.

Now that the .NET SDK will always look in the "NativeAOT runtime pack" for .NET 10 and newer, we can do two things:

  1. Don't bundle the runtime assets in the rid-specific ILCompiler package.
  2. Remove support in the ILCompiler MSBuild targets for the old package layout.

We leave the different properties as-is (ie the split between aotsdk and framework) for usage in our tests.
 
Contributes to #87060

@Copilot Copilot AI review requested due to automatic review settings June 20, 2025 22:10
@jkoritzinsky jkoritzinsky requested review from sbomer and MichalStrehovsky and removed request for MichalStrehovsky and Copilot June 20, 2025 22:10
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@jkotas
Copy link
Member

jkotas commented Jun 20, 2025

Does this break "building packages" https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/nativeaot.md#building-packages workflow for using local builds?

@jkoritzinsky
Copy link
Member Author

I need to update those docs to match the changes, but using it should still be possible (if slightly more annoying).

…store (as otherwise the right version number isn't available until after restore).
@@ -34,6 +34,14 @@ Run `build[.cmd|.sh] -c Release` from the repo root to build the NativeAOT toolc

* Add the package directory to your `nuget.config` file. For example, add `<add key="local" value="C:\runtime\artifacts\packages\Release\Shipping" />`
* Run `dotnet add package Microsoft.DotNet.ILCompiler -v 10.0.0-dev` to add the local package reference to your project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Run `dotnet add package Microsoft.DotNet.ILCompiler -v 10.0.0-dev` to add the local package reference to your project.


```
<ItemGroup>
<PackageDownload Include="Microsoft.NETCore.App.Runtime.NativeAOT.win-x64" Version="[10.0.0-dev]" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<PackageDownload Include="Microsoft.NETCore.App.Runtime.NativeAOT.win-x64" Version="[10.0.0-dev]" />
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="10.0.0-dev" />
<PackageDownload Include="Microsoft.NETCore.App.Runtime.NativeAOT.win-x64" Version="[10.0.0-dev]" />


```
<ItemGroup>
<PackageDownload Include="Microsoft.NETCore.App.Runtime.NativeAOT.win-x64" Version="[10.0.0-dev]" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the version really need to be in square brackets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For PackageDownload it's required and you can't reference a runtime pack via PackageReference (SDK blocks it)

@am11
Copy link
Member

am11 commented Jun 21, 2025

Don't bundle the runtime assets in the rid-specific ILCompiler package.

Are they bundled today? I don't see it:

microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/Icon.png
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/runtime.json
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/tools
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/tools/netstandard
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/tools/netstandard/ILCompiler.Build.Tasks.dll
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/tools/netstandard/ILCompiler.Build.Tasks.deps.json
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/.nupkg.metadata
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/microsoft.dotnet.ilcompiler.nuspec
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/microsoft.dotnet.ilcompiler.10.0.0-preview.6.25304.106.nupkg
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/THIRD-PARTY-NOTICES.TXT
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/WindowsAPIs.txt
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/Microsoft.NETCore.Native.Unix.targets
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/NativeAOT.natstepfilter
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/Microsoft.NETCore.Native.Publish.targets
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/BuildFrameworkNativeObjects.proj
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/Microsoft.DotNet.ILCompiler.SingleEntry.targets
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/findvcvarsall.bat
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/Microsoft.NETCore.Native.targets
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/NativeAOT.natvis
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/Microsoft.NETCore.Native.Windows.targets
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/build/Microsoft.DotNet.ILCompiler.props
microsoft.dotnet.ilcompiler/10.0.0-preview.6.25304.106/microsoft.dotnet.ilcompiler.10.0.0-preview.6.25304.106.nupkg.sha512

runtime.${RID}.microsoft.dotnet.ilcompile is already a separate package.

@filipnavara
Copy link
Member

runtime.${RID}.microsoft.dotnet.ilcompile is already a separate package.

The problem is cross-compiling where the ILCompiler is on the host platform (eg. osx-arm64) and you are targeting a different platform (eg. ios-arm64). Then you'd get runtime.osx-arm64.microsoft.dotnet.ilcompiler with all the SDK assets that are unused because they are taken from the target pack for ios-arm64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants