Description
Description
When building a packaged WinUI app on a pipeline, the artifacts including with Windows runtime dependency are given to the user/customer. The user/customer runs the install PowerShell scripts which I think should install dependencies, however, when they try to launch the app, they are prompted to install the .NET 8 runtime.
Directly from Microsoft Store:
After installing the runtime, the app does start. But this is a very poor user experience and won't be acceptable for the Microsoft Store. My other attempts produced builds that also required .NET8/the app failed to start.
Steps to Reproduce
Attempt 1 (packaged, mostly defaults and where I first encountered the issue):
dotnet publish -f net8.0-windows10.0.19041.0 -c:Release -p:RuntimeIdentifierOverride=win10-x64 -p:PackageCertificateThumbprint=${{ secrets.WIN_CERT_THUMBPRINT }}
App requires .NET8 runtime but it does start successfully.
Generally, I had been following instructions/guidance from here: https://learn.microsoft.com/en-us/dotnet/maui/windows/deployment/publish-cli?view=net-maui-8.0
Attempt 2 (Packaged self-contained app):
dotnet publish -f net8.0-windows10.0.19041.0 -c:Release -p:RuntimeIdentifierOverride=win-x64 -p:Platform=x64 -p:PackageCertificateThumbprint=${{ secrets.WIN_CERT_THUMBPRINT }} -p:WindowsAppSDKSelfContained=true
Including all the workarounds described in: microsoft/WindowsAppSDK#4008
This produces a 49.2mb file (it actually got smaller than my previous builds of 104.4mb without WindowsAppSDKSelfContained
). The same issue occurs and the app also crashes on startup.
Crash log from app center:
ctor
System.Runtime.InteropServices.COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
System.Runtime.InteropServices
Marshal.ThrowExceptionForHR (Int32 errorCode)
WinRT.BaseActivationFactory
WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName)
WinRT.ActivationFactory`1
WinRT.ActivationFactory`1..cctor()
WinRT
ActivationFactory`1.ActivateInstance[I] ()
Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl
Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl..ctor()
Microsoft.Maui.Graphics.Win2D
W2DGraphicsView.UserControl_Loaded (Object sender, RoutedEventArgs e)
ABI.Microsoft.UI.Xaml
RoutedEventHandler.Do_Abi_Invoke (IntPtr thisPtr, IntPtr sender, IntPtr e)
WinRT
ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0 (Int32 hr)
WinRT
ExceptionHelpers.ThrowExceptionForHR (Int32 hr)
ABI.Windows.ApplicationModel.Core
IUnhandledErrorMethods.Propagate (IObjectReference _obj)
Windows.ApplicationModel.Core
UnhandledError.Propagate ()
Microsoft.AppCenter.Utils
ApplicationLifecycleHelperWinUI.<ctor>b__0_3 (Object sender, UnhandledErrorDetectedEventArgs eventArgs)
Generally, I had been following instructions/guidance from here: https://learn.microsoft.com/en-us/dotnet/maui/windows/deployment/publish-unpackaged-cli?view=net-maui-8.0
Attempt 3 (Unpackaged self-contained app):
Update the csproj to have the below but kept all the changes made in Attempt 1.
<WindowsAppSDKSelfContained>True</WindowsAppSDKSelfContained>
<WindowsPackageType>None</WindowsPackageType>
<PublishSingleFile>true</PublishSingleFile>
The folder full of files is roughly about 230mb in size (Which sounds promising). Its an unpackaged app but I think this will be fine for me as I do need to upload this to the Steam store. Strangely, the app isn't a single file?
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Version 10.0.22621 Build 22621 - probably various versions
Did you find any workaround?
No
Relevant log output
No response