Building an MSI From Unpackaged Standalone Windows App SDK

291 views Asked by At

I've gotten the Windows App SDK samples from GitHub and there's both standalone and and unpackaged examples for C++ in there which I'd like to build into an MSI installer. I've tried using Microsoft Visual Studio Installer Projects 2022 and Advanced Installer.

The Visual Studio tool spits an MSI out but keeps prompting me to install .Net 4.7.2 even though my machine has it. I download it using the prompt displayed but it tells me there's a more recent version so no action needs to be taken.

The advanced installer is much better, offering more configurability, actually installs something but the program fails to run anything when I attempt to start it.

Has anyone managed to do this?

Edit:

Using advanced installer, a console app can be built into an msi and deployed and it runs, specifically this sample:

https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/Unpackaged/cpp-console-unpackaged

Attempting the same with:

https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/SelfContainedDeployment/cpp/cpp-winui-unpackaged

results in the event viewer registering an app crash error:

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:

I'm still trying to get this to run on the same machine on which it is being built.

1

There are 1 answers

0
pma07pg On BEST ANSWER

I still haven't been able to acheive this with the Microsoft Visual Studio Installer Projects 2022 extension. I'll hopefully have an update on this at a later date.

Using an alternative such as Advanced Installer (or similar) you'll need to manually add some folders and files to the resources in order for all dependencies to be packaged. I assumed that the installer would be doing this automatically and that there was some issue on the Windows side...

You'll need to include the Assets folder and one language asset folder. You'll also need resources.pri. These were the only requirements and the self packaged installer works.

For how to prepare the actual WindowsAppSdk as an unpackaged, self-contained app then you'll need to add the following entries to your .vcxproj file:

<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<SelfContained>true</SelfContained>
<AppxPackage>false</AppxPackage>
<WindowsPackageType>None</WindowsPackageType>

For an example app then refer to the sample links posted in the question above.