Now, I see your comment.
First, I downgraded all related projects (the app and two libraries) from .Net 10 to .Net 9. The launch of the store version still fails.
Two entries from the Event Viewer:
Application: FolderCleaner.exe
CoreCLR Version: 10.0.125.57005
.NET Version: 10.0.1
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeLoadException: Could not load type 'ComInterfaceEntry' from assembly 'System.Runtime.InteropServices, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at WinRT.FolderCleanerGenericHelpers.GlobalVtableLookup.InitializeGlobalVtableLookup()
at WinRT.FolderCleanerGenericHelpers.GlobalVtableLookup.InitializeGlobalVtableLookup()
at .cctor()
Faulting application name: FolderCleaner.exe, version: 1.0.0.0, time stamp: 0x68f20000
Faulting module name: KERNELBASE.dll, version: 10.0.26100.7623, time stamp: 0x45ad608f
Exception code: 0xe0434352
Fault offset: 0x00000000000ca80a
Faulting process id: 0x10B68
Faulting application start time: 0x1DC90B6255AF974
Faulting application path: C:\Program Files\WindowsApps\600CCC33.FolderCleaner_4.0.84.0_x64__npmv4c3p4dm00\FolderCleaner\FolderCleaner.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 5b2e0c3a-f730-486d-8384-7e04e2cec797
Faulting package full name: 600CCC33.FolderCleaner_4.0.84.0_x64__npmv4c3p4dm00
Faulting package-relative application ID: App
I changed the project file to:
<PropertyGroup>
<!-- ReadyToRun: keep enabled for Release, disabled for Debug -->
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<!-- Trimming: must be OFF for Release to avoid WinUI 3 runtime crashes -->
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
</PropertyGroup>
I got the following two entries in the Event Viewer after failing in launching the store version:
Description: A .NET application failed.
Application: FolderCleaner.exe
Path: C:\Program Files\WindowsApps\600CCC33.FolderCleaner_4.0.85.0_x64__npmv4c3p4dm00\FolderCleaner\FolderCleaner.exe
Message: Failed to load System.Private.CoreLib.dll (error code 0x80131522)
Path: C:\Program Files\WindowsApps\600CCC33.FolderCleaner_4.0.85.0_x64__npmv4c3p4dm00\FolderCleaner\System.Private.CoreLib.dll
Error message: Could not load type 'System.Runtime.CompilerServices.StaticsHelpers' from assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Failed to create CoreCLR, HRESULT: 0x80131522
Description: A .NET application failed.
Application: FolderCleaner.exe
Path: C:\Program Files\WindowsApps\600CCC33.FolderCleaner_4.0.85.0_x64__npmv4c3p4dm00\FolderCleaner\FolderCleaner.exe
Message: Failed to load System.Private.CoreLib.dll (error code 0x80131522)
Path: C:\Program Files\WindowsApps\600CCC33.FolderCleaner_4.0.85.0_x64__npmv4c3p4dm00\FolderCleaner\System.Private.CoreLib.dll
Error message: Could not load type 'System.Runtime.CompilerServices.StaticsHelpers' from assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Failed to create CoreCLR, HRESULT: 0x80131522
Let me state again: both the debug version and the release version launched by VS work flawlessly. Only the store version has this issue.
Let me give you some background on this endeavor. I tried WinUI a few years ago and felt it was not ready for me to jump in. I gave it another shot last month and have invested a lot of time in it by porting two libraries and picking this simple existing store app to experiment with WinUI. At this point, I feel my mission has been accomplished. I will wait until sometime next year to try this project again and report back here.
I appreciate all your help.