Create an installer to install a 64-bit application
Environment
- Visual Studio
-
- Visual Studio Community 2017
- Visual Studio Community 2019
- WiX Toolset
- 3.11.2
※ Works in other versions, but is unconfirmed
At first
WiX installs it as a 32-bit application unless explicitly specified. For example, when you install on a 64-bit OS, it is installed in the C:\Program Files (x86)\folder.
This section describes the settings for installing as a 64-bit application. Assume that you have already created a WiX project and you have created an installer.
By the way, if you install a 64-bit application, is it a 32-bit application or a 64-bit application? Because it depends on the file that i included, please think that the setting of the installer side to the last. You can also explicitly prevent installation on 32-bit OS by supporting the installer 64bit.
Pre-preparation
- Assume that you have created an installer in WiX.
Create a project
Create a new project for the 64-bit installer. If you need to create a 32-bit and 64-bit installer, It is useful to be able to build it at the same time by dividing it into a separate project from 32bit.
Once you've created a project, you'll set up the project as you would the 32bit version, and then Copy the files created in the 32-bit version to the 64-bit project.
In the 64-bit version, you'll need almost the same file as the 32bit version, so there's a way to share the file. Because the explanation becomes a little complicated, I will spare this time.
64bit settings for installer projects
To create an installer for a 64-bit application, change the project settings. If you set the following A or B patterns, you can do so.
Another way to specify x64 for the Platform attribute of the Package is to It is currently deprecated and has no effect when set, and you must set the 64bit parameter for each file to be installed. I do not recommend it because it is inefficient.
A. Add x64 platform to project
Initially, the project only has an x86 build configuration, so add x64.
Select the "Build" menu and "Configuration Manager".
Make the solution configuration Release and select New from the x64 project platform.
Don't create new platforms "x64", "x86" sources, and new solution platforms.
When you add it, open the platform again. Select Edit. By the way, x64 x64 may not be in the list immediately after you add it, but it may be added to the list when you close and refresh the screen.
Remove x86 because of a wix project glitch that causes the initial selection to not switch to x64 and x86. However, this may also be a problem and even if x86 is erased, it will be resurrected. If you want to make sure you delete it, it is a good idea to open the project file "wixproj" in a text editor and delete the code.
If it looks like the figure below, it is OK. The active platform on the top right remains x86, so if you're curious, rename it in edit.
B. Added "-arch x64" to the compilation parameters.
Right-click the 64bit installer project to open Properties.
Select Tool Settings from the left tab and change the configuration to Release. In Additional parameters, enter -arch x64 in Compiler.
Make the destination folder a 64-bit folder
Open Product.wxs.
Replace the following "Directory Id="ProgramFilesFolder" with "Directory Id="ProgramFiles64Folder".
<Wix>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
Change the file or folder name of a shortcut on the Start menu
Not required, but if you copy the 32bit settings as they are, you can copy them directly in the 32-bit and 64-bit application start menus. The shortcut will be covered.
Change it as needed.
<Wix>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="LittleSaviorTrial">
<Component Win64="yes" Id="LITTLESAVIORTRIAL.EXE" DiskId="1" Guid="E382FBDF-73E0-4511-A73D-E9798449F30E">
<File Id="LITTLESAVIORTRIAL.EXE" Name="LittleSaviorTrial.exe" Source="LittleSaviorTrial\LittleSaviorTrial.exe" KeyPath="yes">
<Shortcut Id="LITTLESAVIORTRIAL.EXE_shortcut" Name="ここのファイル名を 64bit 版に変える" Directory="ProgramMenuDir" WorkingDirectory="INSTALLDIR" Icon="LITTLESAVIOR.ICO" IconIndex="0" Advertise="yes" />
<!-- 中略 -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="ここのフォルダ名を 64bit 版に変える">
<Component Id="ProgramMenuDir" Guid="5A73CC85-A1B3-4409-8C4F-3E8E888A7167">
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
Product.wxs overall
Build in this state to make sure that the installer is created without errors. After installing in a 64-bit OS environment, verify that folders and files are created in C:\Program Files\.
Also, check to see if it fails when you try to install in a 32bit OS environment.