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

MAUI Blazor Windows App does not work with Native AOT #3887

Open
strich opened this issue Sep 29, 2023 · 3 comments
Open

MAUI Blazor Windows App does not work with Native AOT #3887

strich opened this issue Sep 29, 2023 · 3 comments
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration

Comments

@strich
Copy link

strich commented Sep 29, 2023

Describe the bug

This is a cross-post bug from the MAUI project (dotnet/maui#17713) at the request of their developers.

I am currently developing an app with Avalonia on .NET 7 and I was curious to see if I could move to MAUI Blazor as it'd improve my productivity. I do not plan to release the app on anything but desktop platforms, and even then I may keep it to Windows.

It is important to me to have Native AOT. I got this working with Avalonia by adding the following to my csproj:

<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
<TrimMode>partial</TrimMode>
<PublishAot>true</PublishAot>
<OptimizationPreference>Speed</OptimizationPreference>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>

I installed the latest MAUI and created the default MAUI Blazor project in VS. I've attempted to apply the same or similar csproj settings, starting with just <PublishAot> and each step of the way the commandline publish has spit out errors. I cannot currently get it to work.

How can I get the default start up project to publish to native AOT?

Steps to reproduce the bug

Create a new .NET Blazor MAUI App in VS.
Remove all platforms from the csproj except Windows to simply things.
Try to get it to compile to AOT.

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Packaging type

Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022-preview, Visual Studio 2022

Additional context

No response

@DarranRowe
Copy link

IIRC, the biggest thing getting in the way of the Windows App SDK being usable for Native AOT is Cs/WinRT. The .NET projections are created using Cs/WinRT.
What's more, since you mentioned .NET 7, the documentation states that Native AOT is targeted at console type applications in .NET 7.
I would suspect that Native AOT will not be fully supported until .NET 8 is released and Cs/WinRT declares full compatibility.

@manodasanW
Copy link
Member

You can find my recent update on AOT status here: #3856 (comment)

@strich
Copy link
Author

strich commented Sep 30, 2023

IIRC, the biggest thing getting in the way of the Windows App SDK being usable for Native AOT is Cs/WinRT. The .NET projections are created using Cs/WinRT. What's more, since you mentioned .NET 7, the documentation states that Native AOT is targeted at console type applications in .NET 7. I would suspect that Native AOT will not be fully supported until .NET 8 is released and Cs/WinRT declares full compatibility.

Note that whilst I initially tried it on net 7 i since moved to NET 8 RC1 and had the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration
Projects
None yet
Development

No branches or pull requests

4 participants