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

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!

Related

Entry for WiX bundle is not removed from the ARP list when uninstalled via UpgradeVersion element

Our application is installed using a WiX bootstrapper. Consequently, the Windows 10 Apps and Features list (a.k.a. ARP) shows an entry for the bundle, and another entry for the .msi which is contained within it.
On my system, I have OurApp v.9.0 installed, as well as v.9.1 Beta. When I install the upgrade, v.9.1 Full Release, it is seen as an upgrade to v.9.0, which is automatically uninstalled. v.9.1 Beta is also uninstalled by use of the following code:
<!-- Uninstall Beta Version [only use this for Full Release] -->
<?if Not $(var.Phase) = "Beta" ?>
<Upgrade Id='233E450E-182F-4823-9C24-2F28A93A52A8'>
<UpgradeVersion OnlyDetect='no' Property='OLDINSTALLER' Minimum='0.0.0' />
</Upgrade>
<?endif?>
Unfortunately, the entry for OurApp 9.1 Beta bundle is sometimes left behind in the ARP list after uninstalling. (The OurApp 9.1 Beta .msi package was successfully removed from the ARP list.) If I try to uninstall the Beta bundle again, it simply disappears without really doing anything. Usually, uninstalling the app from ARP will cause some uninstallation dialogs to appear, but in this case, they don't appear, the entry is simply removed from ARP.
I have looked at the following posts for guidance:
WiX upgrade didn't remove the earlier product from ARP
MSI uninstall does not remove product entry in program features
After using msiexec to uninstall a program it remains in the control panel (add/remove programs)
Unfortunately, these don't seem to be describing quite the same situation as I'm seeing, and I don't understand the suggestions well enough to determine what to do in our case. I did happen to see this comment:
"Duplicate installations are very common in such cases as a by-product of rapid test cycles."
Since "rapid test cycles" would describe well our situation, I'm wondering if this might be the case for us. However, I have 2 difficulties:
I don't understand how to confirm that this is happening or what to do about it.
I get the impression that this would be unlikely to occur on an end-user's system, since they are not participating in these "rapid test cycles". Do we actually need to do anything?
I would appreciate any input / advice on dealing with this situation.
UPDATE:
Here is the WiX code for building our bundle:
<?xml version="1.0"?>
<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"
xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension">
<Bundle
Name='UsefulApp $(var.TruncatedVersion) $(var.Phase)'
Version='$(var.VersionNumber)'
UpgradeCode='$(var.UpgradeCode)'
Tag='UsefulFrmwrkBndl'
IconSourceFile='$(var.UsefulInstallIcon)'
Copyright="Copyright ©$(var.CurrentYear), $(var.ProducedBy). All Rights Reserved."
Manufacturer='$(var.ProducedBy)'>
<bal:Condition Message="32-bit Windows is no longer supported."> (VersionNT64 >= v6.0) </bal:Condition>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<Payload SourceFile="UsefulLicense.htm" />
</BootstrapperApplicationRef>
<!--<RelatedBundle Id='$(var.UpgradeCode)' Action='Detect'/>-->
<WixVariable Id="WixStdbaLicenseUrl" Value="UsefulLicense.htm" />
<WixVariable Id="WixStdbaLogo" Value=".\resources\image_option_1.bmp" />
<WixVariable Id="WixStdbaThemeXml" Value="UsefulHyperlinkTheme.xml" />
<WixVariable Id="WixStdbaThemeWxl" Value="UsefulHyperlinkTheme.wxl" />
<Chain>
<PackageGroupRef Id="NetFx48" />
<PackageGroupRef Id="redist_vc14" />
<RollbackBoundary />
<PackageGroupRef Id='UsefulFrameworkPackGroup'/>
</Chain>
</Bundle>
<Fragment Id='UsefulFrag'>
<PackageGroup Id='UsefulFrameworkPackGroup'>
<MsiPackage Id='UsefulMsiPack'
DisplayName='UsefulApp $(var.VersionNumber)'
DisplayInternalUI='yes'
ForcePerMachine='yes'
InstallCondition='1'
SourceFile='UsefulApp_$(var.VersionNumber)_Installer.msi'
Visible='yes'
Vital='yes'>
</MsiPackage>
</PackageGroup>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version" Variable="Netfx48FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version" Variable="Netfx48x64FullVersion" Win64="yes" />
</Fragment>
</Wix>

How to use Wix msi to selectively install MSI

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>

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 installer install .net if not installed

I stumbled upon this documentation. http://wix.sourceforge.net/manual-wix3/wixnetfxextension.htm.
I can't figure out how to install for example .net4full when it is not installed.
Currently my wix xml looks like this:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*"
.....
.........
>
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4 FULL. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
.....
.........
............
.........
............
</Product>
.......................
..............................
................................
.........................
</Wix>
BTW, I'm using wix 3.7!
In the Wix setup project, you can check the existence of .net framework 4.0 and give a message to user like you have to install .net framework 4.0 before install this product.
But if you want to do silently (Check .net framework 4.0 existence...if available install only your product and if not first install .net framework 4.0 and then install your product) You have to do by wix bootstrapper
Sample Bootstarpper code as follows
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle
Name="My Application" Version="1.0.0.0" UpgradeCode="8DA460D6-B4CB-4ED0-A1FE- 44F269070647" Manufacturer="ABC">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="Agreement.rtf"
LogoFile="App.ico"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="Netfx45Xxx"/>
<MsiPackage SourceFile="D\MySetup.msi" Compressed="yes" EnableFeatureSelection="yes" Vital="yes">
<MsiProperty Name='INSTALLFOLDER' Value='[InstallFolder]'/>
</MsiPackage>
</Chain>
<Variable Name='InstallFolder' Value='[ProgramFilesFolder]MyApp' />
<Fragment>
<PackageGroup Id="Netfx45Xxx" >
<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q"
SourceFile="dotnetfx45_full_x86_x64.exe"
DetectCondition="(Netfx4FullVersion="4.5.50709") AND (NOT VersionNT64 OR (Netfx4x64FullVersion="4.5.50709"))"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion="4.5.50709" OR Netfx4x64FullVersion="4.5.50709"))"/>
</PackageGroup>
This code attach the .net version with itself. If the .net 4.5 is not available in the machine, it will install the framework before install the application setup
The solution for me, using .NET 5 was to include the [ApplicationName].runtimeconfig.json in the application folder.

Wix Burn 3.6 RTM, still installing .NET 4.5 Beta

I'm using WiX Burn to lay down .NET 4.5. It seems really straightforward from the documentation, How To: Install the .NET Framework Using Bur.
My installer is dead simple:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="My App"
Version="1.0.0.0"
Manufacturer="My Company"
UpgradeCode="My GUID-4fa299bf4589"
IconSourceFile="My Icon File" >
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" >
<bal:WixStandardBootstrapperApplication
SuppressOptionsUI="yes"
LicenseFile="License.rtf"
LogoFile="Installer_Banner.bmp"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx45Web" />
<MsiPackage
DisplayName="My App Name"
SourceFile="myMSI.msi"></MsiPackage>
</Chain>
</Bundle>
</Wix>
But when I run the generated EXE file it wants to install .NET 4.5 beta. I've got WiX 3.6.3303 which is RTM and Visual Studio 2012 RTM. How can I fix this problem?
The correct URLs for NETFX v4.5 are used in WiX v3.8. It was a mistake that the URLs were not updated sooner.