Packaging software for Installation on the Windows platform is most commonly accomplished by using the Windows Installer. The WiX installer is one of the many tools available to create Windows Installer packages (.msi files). WiX Installer Xml is a popular and well documented toolset with a large library of online resources to help new integrators get started.
AppLife Cloud is a turn-key software distribution and updating online service that provides the functionality to publish, control and monitor the distribution of software, and future updates, over the internet. AppLife can be implemented using an installable client application that, when connected to an AppLife Subscription, can install and maintain one or more applications on a Windows computer, requiring no source code integration with any of the maintained applications. Alternatively, AppLife can be integrated into an application’s source code to deliver a tightly coupled maintenance process for installed software.
WiX, Major Upgrades, and AppLife
In this article, we’ll use the WiX Toolset to create a Windows Installer for our application that implements a Major Upgrade scheme. Then, we’ll use AppLife Cloud tools to create an online distribution channel for the application. To help support the use of AppLife, we’ll also implement an ARPINSTALLFOLDER Custom Action within the WiX project, which writes to the Windows registry the local directory that the application gets installed into, which AppLife tools use.
The AppLife Builder tool is used to package the application Msi file created by WiX and publish it to the AppLife cloud, where it can be discovered and executed using AppLife Manager. AppLife Manager is a small client software that lives in the Windows System Tray, capable of automatically deploying and maintaining many applications through the AppLife Cloud. As an alternative to using AppLife Manager, the AppLife API can be used to integrate update discover and execution functionality directly into the Windows application.
These examples are based on the standard templates used by Visual Studio 2022 and the Wix Toolset to create the .Net example application and the WiX created Windows Installer(.msi).
The Example Application
Our example application will be a .Net 7 Windows Forms application, created using the Visual Studio application template. We’ll add no functionality as we will be focusing on packaging the application for deployment and future continuous updates and maintenance.
Create the WiX Installer
WiX uses XML files to define how the Windows Installer is created. Compared to other GUI based Windows Installer build tools, WiX has a larger learning curve. After paying the early learning price to get started, our experience suggests literally every objective thereafter relating to Windows Installer functionality is easier accomplished with WiX than other tools.
To get started, install the WiX 3.11 toolset, and then in Visual Studio WiX, the WiX v3 Visual Studio 2022 Extension. To be clear, Visual Studio is not necessary to use WiX, but since we are using Visual Studio and .Net, we’ll use the extension as Visual Studio makes for an excellent XML editor and we can use Visual Studio environment variables to help with accessing sourcing the files and assemblies for inclusion.
Create a new Setup Project using Visual Studio
We’ll make a few immediate changes to the standard template.
1. Embed the CAB file. We want a single MSI file to deploy. To support this, we make a change to the Media Template element.
2. Add ARPINSTALLLOCATION custom action to the installer. This action writes the installation directory to the registry and allows AppLife to lookup the install location using the registry information.
3. Support Major Upgrades. The WiX template is already configured to support Major Upgrades. If starting from an existing WiX project, verify that the UpgradeCode attribute is set on the Project element, the Id attribute is set to *, and the MajorUpgrade element is present in the Product Element.
4. Add a reference to the .Net Application to the WiX msi project. This allows us to use environment variables to source the files we’ll add to the installer.
Add Files to the Installer
This is the output directory of the Visual Studio application. The Windows Installer must deploy the highlighted files. We’ll add the necessary WiX components.
And in the Wix Project….
Now we can build the Windows Installer project and generate an MSI that we will distribute and deploy with AppLife.
Deploy with AppLife Cloud
Create an AppLife Application. If you don’t already have an AppLife Subscription, here’s how to get started.
We’ll start with a newly created AppLife application. Since we’ll be using the Windows Installer, our action list will include only one action, which will execute the Windows Installer file we created with WiX.
Add a Run Windows Installer action to the action list. Select the Windows Installer to run, select the Quiet/Silent option, and finally the Set AppLife Manager Application Directory option.
Publish an AppLife Package
Create version 188.8.131.52 by clicking the Create an Update… button.
For Access Control, leave set to the default Application option. Access control lists can be configured to publish an update package for a specific group of users, but for this example we are using anonymous access and publishing for everyone.
Enable AppLife Manager
To enable any client connected to your AppLife Subscription with AppLife Manager to discover and install this example Windows Forms application, we need to configure the application through the AppLife Cloud dashboard.
And we’ll also set the application access control to allow anonymous access.
With these actions taken, AppLife Manager can discover and deploy this new application. Future updates are then automatically discovered and installed.
AppLife Cloud and the WiX installer combines to create an excellent software package and distribution model for new and old applications that target the Windows platform. With WiX, you can create an MSI that can be installed on any PC, and when combined with AppLife Cloud, you have an instant global Software Distribution network that can be used to deploy and maintain all your applications across your user-base. This short example just scratches the surface on what can be accomplished with both tools. WiX enables everything that is possible with the Windows Installer technology and includes many tools and techniques that we did not touch on to manage large-scale installations. AppLife extends this with a solid distribution system, many actions that can be taken during a package execution far beyond executing an MSI, and access control that can all be accomplished without any source code integration to your applications. Please visit the following additional online resources on these technologies for more information.