Skip to content
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

Explore ways to reduce Microsoft.DotNet.ILCompiler size #75468

Closed
LakshanF opened this issue Sep 12, 2022 · 2 comments
Closed

Explore ways to reduce Microsoft.DotNet.ILCompiler size #75468

LakshanF opened this issue Sep 12, 2022 · 2 comments
Assignees
Milestone

Comments

@LakshanF
Copy link
Member

LakshanF commented Sep 12, 2022

We bundle the build package, Microsoft.DotNet.ILCompiler, with the SDK and the size of the package is not small (zipped SDK[7.0.100-rc.2.22459.2] is around 245MB and the expanded bundle size of Microsoft.DotNet.ILCompiler is around 1MB). It will be good to help reduce the SDK size if possible.

The bulk of the size (~722K) comes from the task, ILCompiler.Build.Tasks.dll, and the associated dependency files (System.Collections.Immutable.dll and System.Reflection.Metadata.dll) under tools\netstandard directory.

The linker is currently investigating an issue around compatibility, where the solution to that problem might have similar requirements, and shadowing its progress is a good idea.

Some options to reduce the SDK size that the build package contribute;

  • Given the runtime package (runtime.RID.Microsoft.DotNet.ILCompiler), is a superset of the build package, use *native.targets and the task file, ILCompiler.Build.Tasks.dll, from the runtime package instead of using the same files from the bundled build package. We currently import the gateway entry point native target, Microsoft.NETCore.Native.targets, from the build package directory. Instead explore using the runtime package location to import this target file. There are currently challenges around evaluating the runtime package directory.
    • The runtime package path happens dynamically (Import directives happen before that), and the UsingTask directive also need to be evaluated early in the MSBuild evaluation process.
  • Using workload option to generate a SDK for NativeAOT. This might have the drawback of the user having to explicitly download the workload first.
  • Use an implicit package reference - this is generally not encouraged by MSBuild
@jkotas
Copy link
Member

jkotas commented Sep 14, 2022

Another issue to consider: How is the system going to work when we ship .NET 8? .NET 8 SDK should be able to publish app that targets .NET 7. Do we need to make sure that the .NET 8 version of Microsoft.DotNet.ILCompiler that is bundled into .NET 8 SDK is compatible with targeting .NET 7? If yes, what is the surface that we need to maintain for this to work?

@agocke
Copy link
Member

agocke commented Jul 18, 2023

I think we've shrunk things down as much as reasonable right now. We can revisit this later if it's a big problem.

@agocke agocke closed this as completed Jul 18, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

4 participants