How to use Wix msi to selectively install MSI - wix

How can i use Wix to check a registry setting, and depending on that value, select the correct MSI from 2 MSIs to install? The registry entry denotes x86 or x64. If x64, the Wix installer should then installed the 64 bit Msi. If x86, it should install 32 bit version.
I tried this, but I just get an error on install that says
"This installation package could not be opened. Contact the vendor to verify that this is a valid Windows Installer package."
Both "chained" MSIs function correctly by themselves.
This is a file Bundle.wxs and is the only file in the Wix project.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="SingleInstaller" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="935daa4e-9b25-4fef-a4a1-0cf6af71a939">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
<!--Search the registry entries for each because it may be under Wow6432-->
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\SomeEntry\" Value="Bitness" Variable="MyRegEntry" Win64="no" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\SomeEntry\" Value="Bitness" Variable="MyRegEntry" Win64="yes" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<!--<MsiPackage SourceFile="D:\Dev\Cwds_Install\bin\x86\Release\JMPS-CC-CWDS3.0.0.0.msi" InstallCondition="Jmps32Bit = x86" Id="Cwds32"/>-->
<MsiPackage SourceFile="D:MyProgram.msi" InstallCondition="MyRegEntry = x86" Id="MyProgram32" />
<MsiPackage SourceFile="D:MyProgram.msi" InstallCondition="MyRegEntry = x64" Id="MyProgram64" />
</Chain>
</Bundle>
</Wix>

Related

Wix Bootstrapper check for Net 4.5.2 & then downloads it also checking windows version

I'm trying to create a wix application that checks for windows install version and downloads the appropriate .net version. It should also check for the windows version.
I've created a .msi with a wix 3.0 project that checks for the appropriate windows version.
<InstallExecuteSequence>
<Custom Action="SetARPINSTALLLOCATION" After="InstallValidate"></Custom>
</InstallExecuteSequence>
<CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" /> <Condition Message="Your version of Windows is too low">
<![CDATA[Installed OR (VersionNT <= 602)]]>
</Condition>
And I've create a burn bootstrapper that downloads .net 4.5.1 and downloads it if it's not installed.
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<PackageGroupRef Id="NetFx451Web"/>
<MsiPackage Id="programName" SourceFile="$(var.SolutionDir)SetupProject1/bin/Release/programNameInstaller.msi"/>
</Chain>
I want to combine these two projects somehow, because apparently this doesn't function together for some reason. I'd like the windows version to be checked first if possible so that .net version doesn't download if the user isn't running windows that is high enough.
Okay I've gotten this figured out. Here is the finished version. (as of now) You will also need to install the dependencies for WixNetFxExtension.dll and WixBalExtension and I believe also WixUtilExtension
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="MyProgramInstaller" Version="1.0.0.0" Manufacturer="myCompany" UpgradeCode="18b18295-d4a1-4174-99ad-f82f6ca4f7ff">
<!-- checking here for anything over windows 7 you can change this value using the following chart -->
<!-- https://learn.microsoft.com/en-us/windows/desktop/Msi/operating-system-property-values -->
<bal:Condition Message="This application requires Windows 7 or higher to run.">
<![CDATA[Installed OR (VersionNT >= 601)]]>
</bal:Condition>
<!-- here's the license statement, would suggest you update this to something more useful. -->
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- here's the .net download installer you can change this using the following chart -->
<!-- http://wixtoolset.org/documentation/manual/v3/customactions/wixnetfxextension.html -->
<PackageGroupRef Id="NetFx451Web"/>
<MsiPackage Id="myProgram" SourceFile="$(var.SolutionDir)SetupProject1/bin/Release/myProgramInstaller.msi"/>
</Chain>
</Bundle>
</Wix>
Cheers!

How to install vcredist.exe files from Wix Setup Bootstrap Project

I am trying to install the Visual C++ Redistributables along with the .msi for my application. However when I go to install the project I keep getting a "Another install is currently running error". Here is my bundle.wxs file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Application" Version="1.0.0.0" Manufacturer="Manufacturer" UpgradeCode="6c5daa41-4ce9-4f20-94b2-2471a6932542">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
<PackageGroupRef Id="MyPackage" />
<MsiPackage Id="MyApplication" SourceFile=".\Application.msi"/>
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="MyPackage">
<ExePackage Id="VisualCPlusPlus32Bit"
DisplayName="Microsoft Visual C++"
SourceFile=".\vcredist_x86.exe"
Vital="no"
InstallCommand="/q /ACTION=Install"
DetectCondition="NOT VersionNT64"/>
<ExePackage Id="VisualCPlusPlus64Bit"
DisplayName="Microsoft Visual C++"
SourceFile=".\vcredist_x64.exe"
Vital="no"
InstallCommand="/q /ACTION=Install"
DetectCondition="VersionNT64"/>
</PackageGroup>
</Fragment>
</Wix>
I have looked at the docs for wix and this tutorial but I still cant get the Visual C++ libraries installed first without two installs run concurrently.
Thanks!
See How To: Install the Visual C++ Redistributable with your installer. This approach uses a Merge Module to include the Visual C++ Redistributables with your msi instead of running vcredist as a separate installer.

WiX Bundle not displaying MSIs in Programs and Features

I've got new, weird behavior in my bundle installation: the MSIs -- which used to appear in Programs and Features -- have stopped appearing in Programs and Features (hereafter referred to as P&F).
The behavior that I'd like to happen is for the programs that I install as MSIs to appear in P&F, giving the user the chance to uninstall them discretely.
What I've tried/noticed:
If I install the MSIs without bundling them:
they appear in P&F, and are able to be uninstalled
moreover, I can control whether they appear in P&F by setting the ARPSYSTEMCOMPONENT property to either 1 (default is 0, meaning "do appear in P*F), that is:
<Property Id="ARPSYSTEMCOMPONENT" Value="1"/>
these changes are reflected in the registry. When examining the key HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall/{GUID}, if I set the property to 1 it shows up (it doesn't show up when I set it to 0, but I think that's because defaults don't show up).
However, when I put the MSIs into a Bundle, bingo-bango-bongo they disappear from P&F! And, if I check the registry, the SystemComponent property is set to 1 for each MSI.
I'm reaching the conclusion that somehow, in my bootstrapper, the SystemComponent properties for my MSIs are being set to 1. But where could these properties be set? Needless to say, I never set them in my WiX XML (at least, I don't think I do). I don't have any special UI for the bootstrapper (just a license), and the MSIs themselves install quietly, with no UI.
I'm stuck! Can anyone shed some light on this?
I'm using Visual Studio 2015, WiX version 3.10. Here's the entirety of my Bootstrapper code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="****"
Version="1.0.5.0"
Manufacturer="****"
UpgradeCode="7be91f26-93f8-400c-9eac-e69383454e03"
IconSourceFile="src\****.ico" DisableModify="yes" DisableRemove="yes"
AboutUrl="****.com"
Copyright="Copyright 2017, ****">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="src\****_License.rtf"
SuppressOptionsUI="yes"/>
</BootstrapperApplicationRef>
<!-- The two registry serarches provide a variable, what version of .NET is installed on the target machine. One search
is for x86, the other for x64. -->
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Net452FullVersion"/>
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Net452x64FullVersion"
Win64="yes"/>
<Chain>
<ExePackage
Id="Microsoft_dot_Net_4.5.2"
Name="Microsoft 4.5.2 Setup"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
SourceFile="executables\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
InstallCommand="/q"
DetectCondition="(Net452FullVersion = "4.5.51209") AND (NOT VersionNT64 OR (Net4x64FullVersion = "4.5.51209"))"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Net452FullVersion = "4.5.51209" OR Net452x64FullVersion = "4.5.51209"))"/>
<ExePackage Id="Microsoft_Visual_C_plus_plus_Redistributable_2015"
InstallCommand="/q"
SourceFile="executables\vc_redist.x86.exe"/>
<RollbackBoundary/>
<MsiPackage SourceFile="$(var.****.TargetPath)"/>
<MsiPackage SourceFile="$(var.****.TargetPath)"/>
<ExePackage SourceFile="executables\****.exe" InstallCommand="/S"/>
<ExePackage SourceFile="executables\****.exe"/>
</Chain>
</Bundle>
</Wix>
The MsiPackage/#Visible attribute controls whether MSI packages are shown in ARP.

Wix util:registrysearch unrecognized

I am using Sharp Develop 4.4.1 to create a wix installer package for my application. The WIX version is the one that came with Sharp Develop, namely version 3.8.
My MSI project builds just fine.
Now I want to include the MSI in a bundle. In the bundle, I want to check if .net 4.5 and ghostscript are installed (otherwise install it). The .net package check is a breeze using packagegroupref.
So far so good.
However, I also want to check if Ghostscript is installed and intend to do this by doing a registry search. Since I am working in a Bundle, I am trying to use <util:RegistrySearch....., but I get an error stating: The Fragment element contains an unhandled extension element 'util:RegistrySearch'. Please ensure that the extension for elements in the 'http://schemas.microsoft.com/wix/UtilExtension' namespace has been provided. (CNDL0200) - d:\SharpDev Projects\NREOutlookTest1\AIFBundle\Setup.wxs:20
This is my bundle code:
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle UpgradeCode="ae0120aa-0ba8-45ac-b3e5-fce0f6b05de6"
Name="!(bind.packageName.AIF)"
Version="!(bind.packageVersion.AIF)"
Manufacturer="!(bind.packageManufacturer.AIF)"
IconSourceFile=".\images\stamp.ico">
<WixVariable Id="WixStdbaLicenseUrl" Value="myurl" />
<WixVariable Id="WixStdbaLogoFile" Value="..\NREOutlookTest1\images\stamp.jpg" />
<WixVariable Id="WixStdbaLogoSideFile" Value="..\NREOutlookTest1\images\stamp.jpg" />
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkSidebarLicense" />
<Chain>
<PackageGroupRef Id="NetFx45Web" />
<PackageGroupRef Id="Ghostscript" />
<MsiPackage Id="AIF" SourceFile="..\AIFSetup\bin\Release\AIFSetup.msi" Visible="no" />
</Chain>
</Bundle>
<Fragment>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\GPL Ghostscript\9.14" Value="GS_DLL" Variable="GhostScriptDetect" />
<PackageGroup Id="Ghostscript">
<ExePackage
Id="gs914"
DisplayName="GPL Ghostscript"
Cache="no"
Compressed="no"
Permanent="no"
Vital="yes"
DetectCondition="GhostScriptDetect >> "gsdll32.dll""
InstallCommand="/S"
SourceFile="gs914w32.exe"
DownloadUrl="http://downloads.ghostscript.com/public/gs914w32.exe" />
</PackageGroup>
</Fragment>
</Wix>
I have included the Wix Extension WixUtilExtension.dll in the project:
OK. I am officially an idiot. I have a post compile script running in sharpdevelop that is doing a candle and light action. I forgot to include the extension in the candle command, which gave me the error. DOH!!

WIX - Major Upgrade Uninstalling files it didn't install

I have divided my WIX installer into 2 primary MSI's, one is large and is rarely updated and the other is small and frequently updated.
They both install to the same directory (ie ..program files/MyCompany/MyProduct/), the issue I am having is that on an upgrade of the smaller installer the files from the large installer are being removed.
How can I prevent the smaller MSI installer from removing the larger MSI installer files on a Major upgrade? The bootstrapper detects (reg check) if the larger MSI is required and will download it as required and the smaller is assumed to always be required.
I am using WIX 3.6 with the default burn bootstrapper.
Bootstrapper:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx='http://schemas.microsoft.com/wix/NetFxExtension'>
<Bundle Name="MyProduct" Version="4.0.6156" Manufacturer="MyCompany" UpgradeCode="cc5f7c9c-8e02-42b7-b202-a3b0865686c5" DisableModify="yes" DisableRepair="yes" UpdateUrl="URI TO SETUP">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense" />
<WixVariable Id="WixStdbaLicenseUrl" Value="URI TO LICENSE AGREEMENT" />
<WixVariable Id="WixStdbaLogo" Value="ClientLogo.png" />
<util:RegistrySearch Id="NetDetect"
Variable="NetFramework"
Root="HKLM"
Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Install" />
<util:ProductSearch Result="version" Guid="DF6C4673-A1B6-419F-B514-DBC096E6CFA8" Variable="ImgagingVersion"/>
<Chain>
<ExePackage Compressed="no"
DownloadUrl="URI TO DOT NET INSTALLER"
Id="DotNet4Install"
InstallCondition="NetFramework <> 1"
SourceFile="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40\dotNetFx40_Full_x86_x64.exe"
Permanent="yes"
InstallCommand="/q /norestart /ChainingPackage "MYPRODUCT""
PerMachine="yes"
Vital="yes"/>
<MsiPackage Compressed="no"
DownloadUrl="URI TO LARGER INSTALLER"
Id="ImagingInstaller"
InstallCondition="ImgagingVersion < v1.0.0.0"
SourceFile="$(var.WIX.Setup.Accusoft.TargetDir)\LargeInstaller.msi"
Vital="yes"
/>
<MsiPackage Compressed="no"
DownloadUrl="URI TO SMALLER INSTALLER"
Id="ClientServiceInstall"
SourceFile="$(var.WIX.Setup.Client.TargetDir)\SmallInstaller.msi"
Vital="yes"/>
</Chain>
</Bundle> </Wix>
Ok the issue I was having was because I was incrementing the version of the boot strapper on every update of the smaller msi installer, instead I am now only incrementing the version number of the msi.