You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been trying to publish a MAUI app as NativeAOT. I have created a new project on Visual Studio and have also used dotnet new maui. In both cases, dotnet publish -f net9.0-windows10.0.19041.0 -c Release produces an executable (and may other files) that takes a second to load but works. However, when I add <PublishAot>true</PublishAot> I get these messages (I am using .NET 9):
C:\Users\User\.nuget\packages\microsoft.web.webview2\1.0.2792.45\lib_manual\net6.0-windows10.0.17763.0\Microsoft.Web.WebView2.Core.Projection.dll : warning IL2104: Assembly 'Microsoft.Web.WebView2.Core.Projection' produced trim warnings. For more information see https://aka.ms/il2104
C:\Users\User\.nuget\packages\microsoft.web.webview2\1.0.2792.45\lib_manual\net6.0-windows10.0.17763.0\Microsoft.Web.WebView2.Core.Projection.dll : warning IL3053: Assembly 'Microsoft.Web.WebView2.Core.Projection' produced AOT analysis warnings.
ILC : Trim analysis warning IL2026: WinRT.BaseActivationFactory._ActivateInstance<I>(): Using member 'WinRT.ComWrappersSupport.GetObjectReferenceForInterface<I>(IntPtr)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This method is not trim-safe, and is only supported for use when not using trimming (or AOT).
ILC : Trim analysis warning IL2026: WinRT.WinrtModule.GetActivationFactory(String): Using member 'WinRT.ComWrappersSupport.GetObjectReferenceForInterface<IActivationFactoryVftbl>(IntPtr)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This method is not trim-safe, and is only supported for use when not using trimming (or AOT).
ILC : Trim analysis warning IL2026: WinRT.DllModule.GetActivationFactory(String): Using member 'WinRT.ComWrappersSupport.GetObjectReferenceForInterface<IActivationFactoryVftbl>(IntPtr)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This method is not trim-safe, and is only supported for use when not using trimming (or AOT).
When I launch the executable, nothing seems to happen. Updating WebView2 seems to solve the first two issues, but not the other three. Event Viewer says that an Application Error occurred, on module Microsoft.UI.Xaml.dll, with exception code 0xc000027b.
The same thing has happened on my Windows 11 laptop and my Windows 10 desktop. Adding <WindowsSdkPackageVersion>10.0.19041.56</WindowsSdkPackageVersion> and <AllowUnsafeBlocks>true</AllowUnsafeBlocks> also makes no difference.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello.
I have been trying to publish a MAUI app as NativeAOT. I have created a new project on Visual Studio and have also used
dotnet new maui
. In both cases,dotnet publish -f net9.0-windows10.0.19041.0 -c Release
produces an executable (and may other files) that takes a second to load but works. However, when I add<PublishAot>true</PublishAot>
I get these messages (I am using .NET 9):When I launch the executable, nothing seems to happen. Updating WebView2 seems to solve the first two issues, but not the other three. Event Viewer says that an Application Error occurred, on module
Microsoft.UI.Xaml.dll
, with exception code0xc000027b
.The same thing has happened on my Windows 11 laptop and my Windows 10 desktop. Adding
<WindowsSdkPackageVersion>10.0.19041.56</WindowsSdkPackageVersion>
and<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
also makes no difference.What can I do?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions