Skip to content

[Blazor] Enable Blazor apps running inside of ASP.NET Core to be Native AoT compiled #51598

Open
0 of 2 issues completed

Description

@javiercn

There are several issues around this topic, and none are very explicit.

This issue will track the work we need to do to make this happen.

AoT has become an important tech across the industry, with emphasis on cloud scenarios, performance and "leanness". As such, it's interesting for Blazor Applications (a subset at least) to be able to be compiled ahead of time.

AoT opens the door to new scenarios, such as:

  • Running on devices with heavy constraints (e.g. IoT)
  • Running on devices with constrained sandboxes (e.g. iOS). While .NET runs in these devices today, Native AOT is a guarantee that we can run anywhere.
  • Providing Web Based UIs for CLI tools (e.g. dotnet tools).

It also enhances Blazor's ability to run on existing scenarios:

  • Serverless (e.g. Azure Functions)
  • Containers (e.g. Kubernetes)

In general, AoT brings in the following benefits:

  • Reduced app size
    • This is important for cloud scenarios where its desirable to achieve higher container density.
  • Faster startup:
    • This impacts cold starts of the application, which is important in serverless contexts.
    • Scale out of rolling updates in Cloud scenarios.
  • Reduced memory demand:
    • AoT apps generally run with less memory compared to JIT apps, since there are many runtime components that are not needed.
  • Increased performance:
    • Many of the constraints imposed by AoT are addressed via optimizations that can be applied at compile time, which in many cases
      leads to better performance.
  • Enhanced security:
    • AoT apps are less susceptible to runtime attacks, since the code is already compiled and there is no JITing happening at runtime.
    • When running in container scenarios, you can "chisel" the container to only have the minimum code needed for the app to run, reducing the surface attack area.

Goals/Scope of the work

  • Investigate and list all the blockers that prevent the app from being AoT.
  • Understand the available solutions for each problem (source generation, etc.)
  • Identify the fixes that we think are valuable for other reasons (perf, better trimming, etc.)
  • Prioritize the set of changes we want to tackle in .NET 9.0 to drive towards this scenario (low hanging fruit, performance, trimming)

Reasoning

We only get the benefits of AoT if we remove all the blockers, so we want to reduce the cost as much as possible by making changes that provide immediate value for other reasons (perf, trimming, etc).

Sub-issues

Sub-issues

0 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. ghost added
    area-blazor
    on Oct 24, 2023
  2. javiercn commented on Oct 24, 2023

    @javiercn
    MemberAuthor
  3. javiercn commented on Oct 24, 2023

    @javiercn
    MemberAuthor
  4. danroth27 commented on Oct 24, 2023

    @danroth27
    Member

    Related issue tracking enabling full trimming: #49409

  5. added
    enhancement
    on Oct 25, 2023
  6. added this to the .NET 9 Planning milestone on Oct 25, 2023
  7. changed the title [-][Blazor] Enable Blazor apps running inside of ASP.NET Core to be trimmed and AoT compiled[/-] on Oct 25, 2023
  8. 15 remaining items

  9. kimdiego2098 commented on Jun 12, 2025

    @kimdiego2098

    hi,any new?

  10. danroth27 commented on Jun 12, 2025

    @danroth27
    Member

    hi,any new?

    @kimdiego2098 Nothing planned for .NET 10.

  11. self-assigned this
    on Jan 5, 2026
  12. alexyakunin commented on Apr 2, 2026

    @alexyakunin

    Any news?

  13. danroth27 commented on Apr 3, 2026

    @danroth27
    Member

    @alexyakunin We hope to make some progress on this in the .NET 11 timeframe, but it's not a committed feature on our .NET 11 roadmap.

  14. maloo commented on Apr 3, 2026

    @maloo

    @danroth27 Would it be an option to first add support for trimming? I've lost many project to other languages where the stand alone exe file size is a limitation. Like CLIs that need a UI och Linux services with admin UIs. Often over 100MB for a basic Blazor app. Considering minimal api and Blazor wasm supports trimming I hope it is not that much left to make it trimmable? Maybe even if some features would be unavailable (unless core ofc). Do you know what is blocking trimming? SignalR?

  15. danroth27 commented on Apr 3, 2026

    @danroth27
    Member

    Would it be an option to first add support for trimming?

    @maloo Yes, that's the bulk of the work. See the child issues of this parent issue.

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

Metadata

Metadata

Assignees

Labels

NativeAOTPillar: Technical DebtPriority:1area-blazorenhancementtriaged

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions