View on GitHub

Installer-Research

Research about Setup Installer Projects

Installer Research

I am Carlos Peña Hernando, student of the Bachelor’s Degree in Video Games by UPC at CITM. This content is generated for the second year’s subject Project 2, under supervision of lecturer Ricard Pillosu.

The phenomenon of Application Packaging

To put you in context, I would like to talk about the cause at a global level about the existence of application packaging software and therefore about this document that you are reading. Let’s start!

The maintenance of desktop and notebook systems has become an expensive proposition for many corporate networks due to application management costs. Since then, New application management techniques are being developed to help enterprises administer their existing PC investments more efficiently.

One of them is application packaging that in general terms can help enterprises manage growing volumes of software for desktop and server systems. But what exactly is Application Packaging?

What is Application Packaging?

Application Packaging is the creation of an executable (or file used by a service) that contains the files, registry and logic to install an application onto a device. This executable or file is known as an installation package.

Therefore, Application packaging involves the preparation of standard, structured software installations targeted for automated deployment. This packages must be prepared and meet the installation requirements for an specific environment (corporate standards for software usage and desktop design, multiple languages, regional issues, etc).

In addition, packages must be prepared for both commercial software and applications developed in-house.

Packaging Content: Application’s Artifacts

Applications are typically more than a single executable. They often contain:

… and much more

Application packages Formats

Application packages include formats such as:

Purpose of Application Packaging

Before we talked about the cause of the existence of application packaging in a global and generic way but What are the concrete purposes and benefits are sought in their use?

The Complexity of Deployment

Deployment is a simple concept, with a complicated mix of variables that can cause the most mysterious errors. In this section it will discuss the most common and important problems generated by the deployment of software and applications.

Microsoft Windows Installer

To enable this level of application management, Microsoft now provides the Microsoft® Windows® Installer (MSI) service as part of its desktop operating systems.

This database-driven service resides on workstations and controls installing, uninstalling, patching, and repairing of software. Input into the Windows Installer is an .msi formatted file as already shown above.

MSI Application Management

The Windows Installer service was designed to support every phase of the application management life cycle, providing a service to support each step involved in managing a desktop application from deployment through retirement.

To support these functions, the Windows Installer needs to receive instructions from an installation package (that was mentioned above).

Windows Installer Technology

Previously, installation packages took the form of a setup.exe file. Unfortunately, inconsistencies in the way independent software vendors and internal software development groups created these installation files sometimes led to complications when administrators attempted to manage automated installations.

The emerging standard is for Windows Installer to use the msiexec.exe program to process the installation packages at an end user’s PC. The packages follow a standardized database structure containing the information that Windows Installer requires to install or uninstall an application and to run the user interface for the setup.

In overall, The Windows Installer technology is divided into two parts that work in combination; these include a client-side installer service (Msiexec.exe) and a Microsoft Software Installation (MSI) package file. Windows Installer uses information contained in a package file to install the program.

But Why use Windows Installer?

Windows Installer has many built-in functions that save time and effort.

MSI files and components

.msi file : A file with .msi extension is a simple database file that can be read by Microsoft Windows Installer service contained in all recent versions of Microsoft Windows. The database contains the files, registry and instructions to the Windows Installer service in order to install the application.

Msiexec.exe : The Msiexec.exe program is a component of Windows Installer. When it is called by Setup, Msiexec.exe uses Msi.dll to read the package (.msi) files, apply any transform (.mst) files, and incorporate command-line options supplied by Setup. The installer performs all installation-related tasks, including copying files to the hard disk, making registry modifications, creating shortcuts on the desktop, and displaying dialog boxes to prompt for user installation preferences when necessary.

When Windows Installer is installed on a computer, it changes the registered file type of .msi files so that if you double-click an .msi file, Msiexec.exe runs with that file.

MSI Extensions : Each installation package includes an .msi file containing the installation database, a summary information stream, and data streams for various parts of the installation. The .msi file can also contain one or more transforms, internal source files, and external source files or cabinet files required by the installation.

What MSI Supports?

Windows Installer can support applications installed from a network share—referred to as an administrative installation—or locally on an end user’s PC. The downside to using a network share can be that systems receive patches or repairs only when they are connected to the network, which may be a consideration for organizations supporting many notebook users.

MSI Packaging and Deployment Tools

Creating MSI files To build the installation package in the correct MSI database format, developers must collect information about each application. Items include executable files, installation instructions, configuration parameters, test instructions, and hardware and software dependencies.

Best practices recommend that installation packages be created by experienced packaging engineers, using tools specifically developed for that purpose.

Industry leaders for MSI creation are generally Advanced Installer, Installshield and the open source solution WiX.

MSI packaging tool selected: WIX Toolset

WiX came around as a way for developers to allow the creation of a binary MSI file from regular text source files. Just like a regular EXE binary, an MSI binary is “compiled” from WiX text XML files. This is a quantum leap in terms of managing your release process and understanding changes in the MSI file.

The toolkit is very comprehensive and much more intuitive for a developer and features a degree of “automagic” in that it shields the developer from some of the intricacies of the MSI database schema since changes are made in an XML format with its own schema and not the database itself.

In effect WiX takes MSI from its database origins into the “XML age” of today so that developers work with text files, and the MSI files can be seen as compiled executables as opposed to database source files.

Summary list about Wix Features

Deployment Tasks on MSI Tools

The tasks and features needed in a setup range from the very fundamental and basic with built-in Windows Installer or third party tool support, to the highly customized tasks called “custom actions” where you have to actually code something yourself to deal with unique deployment requirements.

Set up basics

All third party tools provide good support for these setup fundamentals, but there are some differences. The installation of prerequisites may be the area where third party tools and free frameworks like WiX differ the most in terms of ease of use. The following list shows the fundamentals which all setup must built-in.

Custom Actions

When there is no built-in support for a certain operation or task in Windows Installer itself, or in any of the various third party tools available, you are left having to implement the feature yourself.

When you use Windows Installer, this involves running custom actions of various types (Windows Installer’s mechanism for running executable, custom installation logic during installation).

Custom actions are purpose built executables (binaries: dll, exe) and scripts capable of making advanced modifications to the system during installation that are not supported by Windows installer natively or by the deployment tool in use (WiX, Installshield, Advanced Installer, etc…).

There are different custom action types: implemented as scripts (JavaScript, VBScript), .NET binaries (C#, VB.NET, DTF,…), PowerShell scripts, etc.

Custom actions that make modifications to the system run with elevated rights so that changes can be made to the system even if the logged on user does not have admin rights. There is essentially no limit to what these custom actions can do. They are armed and dangerous.

Custom actions are the leading causes of deployment errors and failure.

Most of the custom functionalities mentioned above are now available in the WiX framework as a custom C++ dll - and other tools have some similar, custom features.

Signing an Application Packaging

Before starting to explain about signing app packages, it is important to understand the meaning of the digital signature. A digital signature is a mathematical scheme based on algorithms for verifying the authenticity of digital messages or documents.

Digital signatures are a standard element of most cryptographic protocol suites, and are commonly used for software distribution, financial transactions, contract management software, and in other cases where it is important to detect forgery or tampering.

Signing an application package provides the user with verification that the application data has not been modified after being signed, while confirming the identity of the user or the company that signed it. Therefore, signing an Application Packaging files is an important thing since you help ensure that tampered files are not installed on end-user computers.

SignTool.exe

There are many methods and ways to approach this topic. Since we are making use of .msi files for the deployment of applications, the best option at the moment is SignTool.exe, SignTool is a command line tool that is used to sign an application package or a batch of applications with a certificate.

The tool is installed in the \ Bin folder of the Microsoft Windows Software Development Kit (SDK) installation path. Then we need Microsoft Windows SDK to be able to work with SignTool.exe. You can download SDK Windows here

How to sign an Application Package (.msi)

signtool sign /sha1 CertificateHash SetupNameFile.msi

Also, WiX provides internal tools for inscribing an MSI with the digital signatures like “Insignia”. You can obtain more information about it here

Testing an Application in a Virtual Machine

Before starting to explain about that, it is important to understand what are virtual machines and his purpose. Virtual machines are one of the safest ways to test software. This method allows you to simulate a full operating system, isolated from the rest of your machine. It’s the perfect way to test our setup installer to check if it works on diferents Operation Systems and its previous versions.

VirtualBox

There are several tools that you can use to create virtual machines, but for we like VirtualBox. It’s available for Windows, OS X, and Linux.

How to work with VirtualBox

Before you start testing software, you’ll need to create the secluded place where you can be alone with it. Begin by creating your virtual machine:

You can download ISO files from Microsoft Windows 7/8/10 here

You can download VirtualBox machine here

Wix Toolset Integration code

The code integrated into the wxs file that is part of the Wix framework is very easy to read and intuitive. It is organized by fragments, which each one is responsible for managing specific features to address a correct deployment for our application.

Project files and components fragment:


<Fragment>
       <DirectoryRef Id="INSTALLFOLDER">
            <Component Id="Motor_2D.exe" Guid="4b886816-febd-4e5c-a87f-923960027d5c">
                <File Id="Motor_2D.exe" Source="..\Release\Motor 2D.exe" KeyPath="yes" Checksum="yes" />
            </Component> 
       </DirectoryRef>
</Fragment>

Directory System fragment:

  
 <Fragment>
		<Directory Id="TARGETDIR" Name="SourceDir">
			<Directory Id="ProgramFilesFolder">
				<Directory Id="INSTALLFOLDER" Name="My UPC Game" />
        
      
         <Directory Id="ProgramMenuFolder">
                <Directory Id="ApplicationProgramsFolder" Name="My UPC Name"/>
         </Directory>
      
      
        <Directory Id="DesktopFolder" Name="My UPC Game" />
      
			</Directory>
		</Directory>

Shortcut Components fragment:

 <Fragment>
  
   <DirectoryRef Id="ApplicationProgramsFolder">
       <Component Id="StartMenuShortcut" Guid="19769afe-ec61-4fdc-9538-42c25a6e8fc8">
          <Shortcut Id="ApplicationStartMenuShortcut" 
                 Name="My UPC Game" 
                 Description="My UPC Game Description"
                 Target="[#Motor_2D.exe]"
                 WorkingDirectory="INSTALLFOLDER"
                 Icon = "icon.ico"/>  
          <RemoveFolder Id="RemoveProgramsFolder" On="uninstall"/>
          <RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
       </Component>
   </DirectoryRef>
   
  <DirectoryRef Id="DesktopFolder">
       <Component Id="DesktopShortcut" Guid="5694ea64-2b00-4584-a671-d26134c1de38">
          <Shortcut Id="ApplicationDesktopShortcut" 
                 Name="My UPC Game" 
                 Description="My UPC Game Description"
                 Target="[#Motor_2D.exe]"
                 WorkingDirectory="INSTALLFOLDER"
                 Icon = "icon.ico"/>  
          <RemoveFolder Id="RemoveDesktopFolder" On="uninstall"/>
          <RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
       </Component>
   </DirectoryRef>

 </Fragment>
      

Icon section:

  
<Icon Id="icon.ico" SourceFile="assets\iconTwitter.ico" />
    <Property Id="ARPPRODUCTICON" Value="icon.ico" />
    

UI Dialog section:

  
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
    <UIRef Id="WixUI_InstallDir" />
   
    
    <WixVariable Id="WixUIBannerBmp" Value="assets\ui_background.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="assets\ui_background.bmp" />
    <WixVariable Id="WixUILicenseRtf" Value="assets\License.rtf" />

UI Dialog section:

 <Feature Id="ProductFeature" Title="WIX_Setup" Level="1">
      <ComponentRef Id="Motor_2D.exe"/>
      <ComponentRef Id="StartMenuShortcut" />
      <ComponentRef Id="DesktopShortcut" />
      <ComponentGroupRef Id="HeatGenerated" />
		</Feature>

TODO’s and Solutions

In order to perform the following exercises, it is highly recommended to spend some time reading the documentation / user manual provided by the Wix Toolset framework. You can access directly by clicking here.

TODO1 : Customize product features + mapping exe project file

Explication:

You have to add the .exe file of the project by creating a “component” element in the appropriate fragment. Once created, you must add the required attributes (ID and GUID) and create as your child a “File” element where you have to add your path as an attribute. You must use the “DirectoryRef” element to reference the folder where you want the .exe file to be copied and use the “ComponentRef” element in the feature section to tell the framework to execute said action.

Test:

If you run the .msi file generated after build WIX Setup project, the executable will be installed silently on your computer. You can find it both in the ProgramFilesFolder directory in its corresponding folder and in the Control Panel.

Solution:

Into Component fragment:

<DirectoryRef Id="INSTALLFOLDER">
            <Component Id="Motor_2D.exe" Guid="4b886816-febd-4e5c-a87f-923960027d5c">
                <File Id="Motor_2D.exe" Source="..\Release\Motor 2D.exe" KeyPath="yes" Checksum="yes" />
            </Component> 
       </DirectoryRef>

Into Feature fragment:

 <ComponentRef Id="Motor_2D.exe"/>

TODO2 : Add Start Menu Shortcut

Explication:

You have to add in directory system section the “ProgramsMenuFolder” directory and inside it, create the directory where to instantiate the start menu shortcut. Then, you must create it as a “component” element following the guidelines used in the previous TODO and add as a child the “Shortcut” element where you have to indicate the .exe that you want the shortcut to point to. Finally, use the “ComponentRef” element to notice the framework to execute the instruction.

Test:

If you run the .msi file generated after build WIX Setup project, the executable will be installed silently on your computer and the start menu shortcut will be instanced in the start menu of your computer. You can also find the folder created where the shortcut was generated in “ProgramMenuFolder” directory

Solution:

Into Directory System fragment:

<Directory Id="ProgramMenuFolder">
                <Directory Id="ApplicationProgramsFolder" Name="My UPC Name"/>
         </Directory>

Into Shortcut Component fragment:

 <DirectoryRef Id="ApplicationProgramsFolder">
       <Component Id="StartMenuShortcut" Guid="19769afe-ec61-4fdc-9538-42c25a6e8fc8">
          <Shortcut Id="ApplicationStartMenuShortcut" 
                 Name="My UPC Game" 
                 Description="My UPC Game Description"
                 Target="[#Motor_2D.exe]"
                 WorkingDirectory="INSTALLFOLDER"
                 Icon = "icon.ico"/>  <!-- TODO 4: Implement Control Panel Icon + Shortcut Icons. -->
          <RemoveFolder Id="RemoveProgramsFolder" On="uninstall"/>
          <RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
       </Component>
   </DirectoryRef>
   

Into Feature fragment:

   <ComponentRef Id="StartMenuShortcut" />   

TODO3 : Add Desktop Shortcut

Explication:

Do the same as in the previous TODO, with the difference that the folder where the desktop shortcut will be instantiated does not need any extra directory.

Test:

If you run the .msi file generated after build WIX Setup project, the executable will be installed silently on your computer and the Desktop shortcut will be instanciated on your Computer Desktop.

Solution:

Into Directory System fragment:

 <Directory Id="DesktopFolder" Name="My UPC Game" />
 

Into Shortcut Component fragment:

 <DirectoryRef Id="DesktopFolder">
       <Component Id="DesktopShortcut" Guid="5694ea64-2b00-4584-a671-d26134c1de38">
          <Shortcut Id="ApplicationDesktopShortcut" 
                 Name="My UPC Game" 
                 Description="My UPC Game Description"
                 Target="[#Motor_2D.exe]"
                 WorkingDirectory="INSTALLFOLDER"
                 Icon = "icon.ico"/>  <!-- TODO 4: Implement Control Panel Icon + Shortcut Icons. -->
          <RemoveFolder Id="RemoveDesktopFolder" On="uninstall"/>
          <RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
       </Component>
   </DirectoryRef>

Into Feature fragment:

<ComponentRef Id="DesktopShortcut" />

TODO4 : Implement control panel icon + exe project icon (shortcuts)

Explication:

For shortcut icons, you just need to modify shortcut components you created before adding the attribute “Icon” inside Shortcut element. For control panel icon, you need to import the icon.ico using the “Icon” element and adding a property to work property with the control panel from your computer.

Test:

If you run the .msi file generated after build WIX Setup project, the executable will be installed silently on your computer and you will find all the shortcuts and control panel with icon.

Solution:

Into product fragment:

 <Icon Id="icon.ico" SourceFile="assets\iconTwitter.ico" />
    <Property Id="ARPPRODUCTICON" Value="icon.ico" />

Into Shortcuts fragment:

 Icon = "icon.ico"/>

TODO5 : Add UI Dialog theme (installDir)

Explication:

First, you have to add to the WixSetup project as a reference the “WixUIExtension” dll provided by Wix Toolset and once imported, you have to use the external element “UIRef” with the appropriate property to generate the chosen dialog theme (in this case, will use the InstallDir).

Test:

If you run the .msi file generated after build WIX Setup project, for the first time the dialog boxes will be executed and the user will be able to interact with the installer and its dialog features, such as the path where to install the program, accept the license, etc.

Solution:

Into product fragment:

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
    <UIRef Id="WixUI_InstallDir" />

TODO6 : Customize UI Dialog theme with bmp files

Explication:

You have to use the “WixVariable” element to be able to import the path of the bitmap files with the correct ID.

Test:

If you run the .msi file generated after build WIX Setup project, the dialog boxes will have been customized with the imported bitmap files.

Solution:

Into product fragment:

 <WixVariable Id="WixUIBannerBmp" Value="assets\ui_background.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="assets\ui_background.bmp" />

TODO7 : Add Windows License into UI Dialog

Explication:

You need to do the same as previous TODO using “WixVariable” element and import License.rtf file

Test:

If you run the .msi file generated after build WIX Setup project, the dialog box where displays the Lorem Ipsum language will be changed to the License you imported.

Solution:

Into product fragment:

  <WixVariable Id="WixUILicenseRtf" Value="assets\License.rtf" />

TODO8 : Uncomment game components (dll, assets. etc)

Explication:

Uncomment ComponentGroupRef to make enable the game components & dll’s and enjoy the awesome game you have installed!

Test:

If you run the .msi file generated after build WIX Setup project, the executable will work property.

Solution:

Into product fragment:

  <ComponentGroupRef Id="HeatGenerated" />

Acknowledgements and Webgraphy

Application Packaging: Basics and Benefits

Installation (computer programs)

What are the benefits of a MSI installer over a standard setup.exe?

What is the benefit and real purpose of program installation?

What installation product to use? InstallShield, WiX, Wise, Advanced Installer, etc

Windows Installer

The Basics of Application Packaging: Best Practices for Enabling Reduced Software Management Costs

Wix Resources

WiX Toolset Manual Table of Contents

Wix Toolset 3.11 github

stackoverflow wix tags

Free software for Windows installers: NSIS vs. WiX?

What is MSI Installer?

Windows Installer Wikipedia

MSI Format

Overview of the Windows Installer Technology

What is the difference between client application and service application?

About the Windows Installer Service

Application Packaging Training- AdminStudio, InstallShield Course

Installation and Maintenance of Games

Windows Installer for Game Developers

How to: Sign Setup Files with SignTool.exe

SignTool

more SignTool

How to sign an app package using SignTool

How to Safely Test Software Without Messing Up Your System

Download VirtualBox

Windows Installer for Game Developers

Installation and Maintenance of Games