I want to provide an installable WindowsAppSDK application which is entirely self contained and unpackaged. We provide a client with an installer and the prerequisites, WindowsAppSdk runtime and everything else necessary is installed/shipped and it just works.
I took the unpackaged C++ console sample from here https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/Unpackaged/cpp-console-unpackaged and built an MSI using free version of Advanced Installer (there's a bug in the Microsoft Visual Studio Installer Projects 2022 extension**)**. This worked on my local machine. When I moved the MSI to a Windows 10 machine, I had to manually install the VC++ Redistributables but it subsequently worked.
The next step was taking this sample https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/SelfContainedDeployment/cpp/cpp-winui-unpackaged. Building this is into an MSI succeeds but deploying, even to my own machine, is consistently unsuccessful. There are no errors thrown, the exe just doesn't start. The windows event viewer shows an application crash with these details:
Faulting application name: SelfContainedDeployment.exe, version: 0.0.0.0, time stamp: 0x65537f0e
Faulting module name: Microsoft.UI.Xaml.dll, version: 3.1.4.0, time stamp: 0x88757e1c
Exception code: 0xc000027b
Fault offset: 0x00000000003b6ee4
Faulting process ID: 0x0x54C8
Faulting application start time: 0x0x1DA17080FC374D0
Faulting application path: C:\Program Files\SelfContained\SelfContainedDeployment.exe
Faulting module path: C:\Program Files\SelfContained\Microsoft.UI.Xaml.dll
Report ID: 71f6355c-8eaa-4f44-b3c9-985a813658ce
Faulting package full name:
Faulting package-relative application ID:
The vcxproj has the correct properties assigned:
<AppContainerApplication>false</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformMinVersion>10.0.22000.0</WindowsTargetPlatformMinVersion>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<AppxPackage>false</AppxPackage>
<WindowsPackageType>None</WindowsPackageType>
I haven't changed anything within this sample so it should be configured properly. As the code runs from VS on my machine and from the build folder inside the project, there can't be anything missing.
Please advise on how this can be done.