build(wix): bundle Universal C Runtime

Fixes #979.
This commit is contained in:
Oleg Shparber 2020-08-15 15:50:12 -04:00
parent 806d72ee33
commit 994cc5f6b6
2 changed files with 28 additions and 4 deletions

View File

@ -36,16 +36,25 @@ if ($DevBuild) {
$compressionLevelArg = '-dCompressionLevel="none"'
}
$VCRedistPath = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Redist\MSVC\v142\MergeModules'
$VCRedistFile = "Microsoft_VC142_CRT_$Arch.msm"
Write-Output "Running candle..."
& candle.exe -nologo -pedantic -wx -arch "$Arch" -dAppVersion="$Version" -dAppPackageDir="$PackagePath" $compressionLevelArg -o "$WixobjFilename" zeal.wxs
& candle.exe -nologo -pedantic -wx -arch "$Arch" `
-dAppVersion="$Version" `
-dAppPackageDir="$PackagePath" `
-dVCRedistPath="$VCRedistPath" `
-dVCRedistFile="$VCRedistFile" `
$compressionLevelArg `
-o "$WixobjFilename" zeal.wxs
if ($LastExitCode -ne 0) {
CleanUp
throw "candle failed with exit code $LastExitCode."
}
Write-Output "Running light..."
& light.exe -nologo -pedantic -wx -ext WixUIExtension -o "$MsiFilename" "$WixobjFilename"
# Supressing LGHT1076, see https://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_vcredist.html
& light.exe -nologo -pedantic -wx -sw1076 -ext WixUIExtension -o "$MsiFilename" "$WixobjFilename"
if ($LastExitCode -ne 0) {
CleanUp
throw "light failed with exit code $LastExitCode."

View File

@ -12,6 +12,14 @@
<?define CompressionLevel="high" ?>
<?endif?>
<?ifndef VCRedistPath ?>
<?error VCRedistPath must be set ?>
<?endif?>
<?ifndef VCRedistFile ?>
<?error VCRedistFile must be set ?>
<?endif?>
<?define AppName="Zeal" ?>
<?define AppManufacturer="Oleg Shparber" ?>
<?define AppExeName="zeal.exe" ?>
@ -32,7 +40,8 @@
Language="1033" Codepage="1252">
<Package Id="*" Description="$(var.AppName) $(var.AppVersion) Installer"
Languages="1033" Compressed="yes" SummaryCodepage="1252" />
Languages="1033" Compressed="yes" SummaryCodepage="1252"
InstallerVersion="301" />
<MajorUpgrade
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
@ -68,8 +77,14 @@
<ComponentRef Id="ProtocolHandlers" />
</Feature>
<Feature Id="VCRedist" Title="Visual C++ Runtime" AllowAdvertise="no" Display="hidden">
<MergeRef Id="VCRedist" />
</Feature>
<!-- Directory Structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Merge Id="VCRedist" SourceFile="$(var.VCRedistPath)\$(var.VCRedistFile)" DiskId="1" Language="0" />
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.AppName)">
<Directory Id="APPLICATIONFOLDER_IMAGEFORMATS" Name="imageformats" />