2

We have an older ClickOnce installer for a Windows application that has a prerequisite for a Setup.exe file from a 3rd party vendor. (webvew2 to be exact)...
The ClickOnce installer has been working fine for years and when it first installs our Windows application, it also installs the 3rd party vendors app by running their Setup.exe as a prerequisite.

Now we would like to move away from ClickOnce and into MSIX.
Creating the Windows Application Packaging Project was pretty simple by just adding our Windows application as a project reference but we can't seem to figure out how to add the 3rd parties Setup.exe as a prerequisite / Dependency inside the new Windows Application Packaging Project.
The following article talks about editing the "appinstaller" file so it can include "OptionalPackages" but that only seems to work for "MainPackage" yet my appinstaller file has "MainBundle".
https://www.syncfusion.com/succinctly-free-ebooks/msix-succinctly/distribute-your-msix-packages
This article talks about using desktop6:InstallActions but it says "This element is currently intended to be used only by desktop PC games...".
https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop6-installactions

Also, the "bootstrapper" we are trying to add to the MSIX is Microsoft WebView2.
https://developer.microsoft.com/en-us/microsoft-edge/webview2/
They do have samples on deployment for Wix and VS Installer but nothing on MSIX.
https://github.com/MicrosoftEdge/WebView2Samples#webview2-deployment

I have read a lot of the articles for MSIX documentation but just can't seem to find good examples on 3rd party dependencies.
https://learn.microsoft.com/en-us/windows/msix/

I think I am missing something since this was basically checkboxes in ClickOnce.
Any idea how to add a 3rd party Setup.exe as a dependency so that it gets installed with our application?

goroth
  • 2,510
  • 5
  • 35
  • 66

2 Answers2

1

I believe MSIX does not have a good way to handle dependencies like this. Some advice from the WebView2 team:

Store/MSIX support for WebView2 is lacking at the moment, as we're currently working on issues in the same category but with higher priority ... but we will get there later.

One thing you can do right now, if you're a Win32 full trust Store app or MSIX app, is that if the runtime isn't already installed, you can download the installer from our CDN (or package the installer with your MSIX package) and then invoke it to install the runtime during app first launch. This requires elevation as WebView2 can only be installed per system right now.

Best of luck. In my experience MSIX is poorly documented and has very poor support for situations outside the "happy path". I hope you're able to make it work.

Reilly Wood
  • 1,753
  • 2
  • 12
  • 17
  • Thanks for the link. I still can't find good articles on this part "package the installer with your MSIX package and then invoke it to install the runtime during app first launch". How does someone "package" it with their MSIX package? – goroth Nov 25 '21 at 16:39
  • I would probably start with [MakeAppX](https://learn.microsoft.com/en-us/windows/msix/package/create-app-package-with-makeappx-tool); it's the main CLI tool for creating MSIX packages. You give it files, it returns a MSIX package. If you include your installer exe when generating the MSIX package, it will end up on disk next to your exe after installation (in C:\Program Files\WindowsApps\package_id). Then you run it with Process.Start or similar. I haven't tried this personally but I think it should work. If this all seems painful and unnecessarily difficult: welcome to MSIX – Reilly Wood Nov 26 '21 at 17:44
1

MSIX only handles other MSIX/APPX dependencies and you cannot add other types of packages (EXE/MSI/CO).

When you declare a dependency in the APPXManifest file, the following details must be specified:

  1. Name: The name of the application (Firefox for example)
  2. Publisher: The publisher of the app
  3. MinVersion: The minimum version of the dependency which must be present on the system for the MSIX to be installed, declared as Major.Minor.Build.Revision

You can also declare the dependency as optional by using the uap6:Optional="true" element. If this element is not placed in the manifest, then the installation of the main package fails if it doesn't find the dependency installed on the system. If the application is available in the Microsoft Store, the MSIX app first downloads the dependency from MS Store, installs it, and then proceeds to install the main MSIX app.

In your case, the WebView2 is not available in the Store, meaning you cannot declare it as a dependency. As Reily mentioned above, you can also think of an alternative to pack the setup.exe in the MSIX and use a PowerShell script to be triggered once during the first run of the MSIX application that you have (keep in mind that the first run must be executed with administrator rights), but it's not a perfect scenario unfortunately.

Alex Marin
  • 174
  • 1
  • 6
  • From my understanding PowerShell scripting from inside the MSIX requires ExecutionPolicy RemoteSigned which is not something I can ask my customers to do on their machines. https://learn.microsoft.com/en-us/windows/msix/psf/run-scripts-with-package-support-framework It is a shame that MSIX is not even close to ClickOnce when it comes to installing prerequisites. – goroth Nov 25 '21 at 16:44