Use top-level statements + source gen for .NET MAUI app startup/config code #2243
Labels
area-templates
Project templates, Item Templates for Blazor and MAUI
Task
neither bug nor feature but something that needs to be done in support of either
Milestone
Consider changing .NET MAUI app startup/config code (the stuff that sets up builders, DI, fonts, services, etc.) to use top-level statements, much like ASP.NET Core apps do in .NET 6.
Imagine your app had a file such as
/MyProject/MauiProgram.cs
with this being the exact contents of the file:The default/common namespaces are all imported by the SDK and you don't need a namespace/class/method declaration. We'd use magical source generators or some other new fangled feature to detect this file and massage its contents into runnable code that can be used in the app.
This concept has come up several times, and there's even a prototype of some aspects of this.
Here are some notes from the recent PR that sparked this again:
@mhutch said:
@Redth said:
@mhutch said:
The text was updated successfully, but these errors were encountered: