Create an installer in WiX to distribute upgraded applications
- Visual Studio
- Visual Studio Community 2017
- Visual Studio Community 2019
- WiX Toolset
※ Works in other versions, but is unconfirmed
Provides step-by-step instructions on how to create an installer when you upgrade an application. Based on the article on the steps to create the first version of the installer, There may be a difference in the way of making.
If you want to keep the previous project before updating, back it up in some way, such as copying the files.
- The first version of the installer has been created and the project exists.
What are the types of upgrades?
There are several upgrade methods for upgrading as you can see in the following articles, The steps here describe major upgrades. This is not a problem unless there are special circumstances.
Start Visual Studio and open the project (solution file) that you have created.
Open Product.wxs and change the following parameters:
If you are performing a major upgrade, replace this ID with the new GUID.
Minor upgrades and small upgrades do not need to be changed, but they are not discussed here.
<Wix> <Product Id="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" />
It is used to determine if it is a newer version during installation, so it increases the number than the previous version. There are four numbers of "Major Version.Minor Version.Revision.Build". There are three major versions.minor version.revisions that determine whether a version has gone up.
It doesn't matter if you increase the number, but basically it's safe to match it with the version of the application.
<Wix> <Product Version="18.104.22.168" />
This code identifies whether it is an upgrade of the same application. Therefore, if you want to upgrade with an overwrite installation, do not change it from the code when it was first released.
Conversely, if you want to upgrade but install it as a separate application, replace it with a new GUID.
<Wix> <Product UpgradeCode="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX">
Message to display when you start the old installer with a newer version of the application already installed. It's used for older versions of the installer, so you don't need to change it if you're already setting up a message in a previous version. If you want to change it, rewrite it.
If you want to display Japanese, you must set the attributes of Languages and SummaryCodepage to the Japanese setting (Japanese support is introduced in a separate article). ProductName is replaced by the product name.
<Wix> <Product> <MajorUpgrade DowngradeErrorMessage="すでに新しいバージョンの [ProductName] がインストールされているため、インストールを中断します。" />
Deploy the files to install
Just like when you first created the installer Please re-enter the new program or related files. Delete files that you no longer use.
If you want to change the license agreement that you want to display on the installation screen, please change the contents.
Product.wxs installation file information update
* You do not need to do any thing about the work of this item if the files and folder configuration to be installed have not changed at all from the previous version.
The most important part of this item is to erase and recreate all the previous file installation settings. If you've increased or decreased only one file, it might be faster to play with product.wxs code directly.
Open product.wxs file.
Select Files from the icon on the left. Delete the folder slower in ProgramFilesFolder.
Right-click the ProgramFilesFolder folder and select Import Folder.
Select the folder where you want to install the files.
A set of files is added to the tree.
To associate with other parameters, select the folder you added and re-set "Id" to "INSTALLFOLDER".
Create a shortcut for the Start menu. Because this shortcut creation work becomes the same work every time, It might be faster to save the XML code and paste it later. (Selection part of the image below)
Select "New" or "Shortcut" from the right-click menu of the exe file.
Select when shortcut is added and right-click the blank to add the property.
Add the following parameters: (Please correct the unique name to match the program.)
|Id||LITTLE SAVIORTRIAL. EXE_shortcut|
|Name||Little Saber Trial|
|Icon||LITTLE SAVIOR. Ico|
Then select the Feature tab.
Add any files that you have added, or delete any files that you no longer need.
If you're having trouble working with the UI, you can edit the XML directly.
Build and run confirmation
Build in Visual Studio to create an installer.
If you are installing a previous version, run the new version of the installer and make sure that it is installed over.
Also, try to make sure that you cannot install a new version when you run the previous version of the installer while you are installing it.