Prevent Burn from uninstalling .NET package - wix

I'm using a WiX bootstrapper to install .NET and my application. The .NET installation is specified in a chain using the statement
<PackageGroupRef Id="NetFx40Redist">
When I uninstall using the bootstrapper, the .NET package is also uninstalled. How can I modify the above statement to tell the bootstrapper not to remove the .NET package?
EDIT: Following is the code I ended up writing to do this. Comments are welcome if there is anything I should do differently.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="appName" Version="$(var.Version)" Manufacturer="mfr" UpgradeCode="your-GUID"
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]mfrName\appName" />
<Chain>
<PackageGroupRef Id="Net4Redist"/>
<MsiPackage
Id="MsiInstaller"
Compressed="yes"
SourceFile="$(var.SolutionDir)\appName_Installer\bin\$(var.Configuration)\appName_Installer.msi"
Permanent="no"
Vital="yes">
<MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]" />
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="Net4Redist">
<ExePackage Id="Netfx40Xxx" Cache="no" Compressed="yes" PerMachine="yes"
Permanent="yes" Vital="yes" InstallCommand="/q"
SourceFile="$(var.SolutionDir)\Bootstrapper\redist\dotNetFx40_Full_x86_x64.exe"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0)"/>
</PackageGroup>
</Fragment>
</Wix>

Did you try using the "Permanent" attribute in the EXEPackage element?
EXEPackage

Glad you solved your issue but, as you mentioned, you do not have any detect condition setup so that is probably why you are seeing .NET processing every time you run your installer. If you add the following registry search and detect condition to your example you should not see that anymore:
<Fragment>
<util:RegistrySearchRef Id="NETFRAMEWORK40"/>
<PackageGroup Id="Net4Redist">
<ExePackage Id="Netfx40Xxx" Cache="no" Compressed="yes" PerMachine="yes"
Permanent="yes" Vital="yes" InstallCommand="/q"
SourceFile="$(var.SolutionDir)\Bootstrapper\redist\dotNetFx40_Full_x86_x64.exe"
DetectCondition="NETFRAMEWORK40"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0)"/>
</PackageGroup>
</Fragment>

Related

how to check condtiotion for version check in bootstraper (wix)?

I am using bootstraper to install VC++ and .net framework,
<?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="Engage" Version="1.0.0.0" Manufacturer="my Corporation" UpgradeCode="d7d559b1-3388-4275-91e2-d8d44d2f02db">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="Netfx45FullPackage" />
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="Netfx45FullPackage">
<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" SourceFile=".\NDP452-x86-x64ENU.exe" />
<ExePackage Id="VC2013" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" SourceFile=".\vcredist_x862013.exe" />
<MsiPackage Id="MyProg" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="D:\Projects\Crimson\engage.client\EngageSetupCreator\bin\Debug\EngageSetupCreator.msi" />
</PackageGroup>
</Fragment>
</Wix>
currently iam installing those two without checking any condition, what should I do to check if the same version for vc++ and .netframework exist, and if exist skip the installation ?
no need to install again if already exists.
You need to add detect condition and use registry search to get the installed version.
For example:
<?define NetFx451MinRelease = 378675 ?>
<util:RegistrySearchRef Id="NETFRAMEWORK45"/>
<ExePackage Id="NetFx451"
...
DetectCondition="NETFRAMEWORK45 >= $(var.NetFx451MinRelease)"
...
>
</ExePackage>
Same for the vc++.

Wix Burn automatically cancelling

I have a very simple Burn bootstrapper that installs the Visual Studio 2015 Redistributable and then runs our application installer (created with Wix). During installation, after installing the redistributable, a dialog pops up automatically that asks if I would like to cancel (i.e., the same thing that would happen if I clicked the Cancel button).
I've created several other installers that use this same pattern and never have seen this problem. Below is the simplified installer with some identifying information removed:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<?define ProductVersion = "1.0"?>
<?define Manufacturer = "XXXX, Inc."?>
<?if $(var.Platform) = x64 ?>
<?define VCRedistExe = "vc_redist.x64.exe"?>
<?else?>
<?define VCRedistExe = "vc_redist.x86.exe"?>
<?endif?>
<Bundle Name="$(var.ProductName)" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)" Condition="VersionNT >= v6.0">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" >
<bal:WixStandardBootstrapperApplication LicenseFile="$(var.AssetsPath)\License.rtf" SuppressOptionsUI="yes"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="redist"/>
<MsiPackage SourceFile="$(var.MsiPath)" DisplayInternalUI="no"/>
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="redist_vc140">
<ExePackage Id="vc140" DisplayName="Visual C++ 2015 Redistributable" Cache="no" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes" SourceFile="resources/$(var.VCRedistExe)" InstallCommand="/install /quiet /norestart" Protocol="burn">
<ExitCode Value="3010" Behavior="forceReboot"/>
<!-- Ignore "Newer version installed" error -->
<ExitCode Value="1638" Behavior="success"/>
</ExePackage>
</PackageGroup>
</Fragment>
<Fragment>
<PackageGroup Id="redist">
<PackageGroupRef Id="redist_vc140"/>
</PackageGroup>
</Fragment>
</Wix>
I believe you should remove the following exit code, as it is not necessary for installing your packages. Possibly conflicting with your bootstrapper installation.
<ExitCode Value="3010" Behavior="forceReboot"/>
Hope this helps you!

WiX Bootstrapper doesn't start/work

Ive a problemm with my wix bootstrapper to install .Net 4 and my application(.msi generated with wix 3.7). When i compile my solution everything is ok, and the generated exe has the right size(not sure if important, when i use winrar to open the exe there are just a few files in it, and not the files i want to install).
When i double click my exe nothing happens(with and without administrator).
<?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="Bootstrapper" Version="1.0.0.0" Manufacturer="asdf"
UpgradeCode="{D188D758-2913-4BA8-B9BA-FEC5B4BCCBD7}">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="Netfx4Full"/>
<MsiPackage Id="Myapp" SourceFile="$(var.Myapp.TargetPath)"/>
</Chain>
</Bundle>
<Fragment>
<!-- Check for .NET 4.0 -->
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage Id="Netfx4Full"
DisplayName="Microsoft .NET Framework 4.0"
DownloadUrl="http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe"
Compressed="no"
Cache="yes"
PerMachine="yes"
Permanent="yes"
Protocol="netfx4"
Vital="yes"
SourceFile=".\dotNetFx40_Full_x86_x64.exe"
InstallCommand="/passive /norestart"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
</PackageGroup>
</Fragment>
</Wix>
Myapp.msi is imported as reference in the bootstrapper projekt.
May someone can help me where ive to look(iam not sure if im able to create a logfile)
if theres any code i should post pls let me know
Thank u very much
Have you tried including the "Compressed" attribute for your MSIPackage entry? For example:
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="Netfx4Full"/>
<MsiPackage Id="Myapp" SourceFile="$(var.Myapp.TargetPath)" Compressed="yes" Vital="yes" />
</Chain>
The "Compressed" attribute tells Burn to include your msi in the generated bootstrapper package. The "Vital" attribute tells Burn that your msi is required.
Also, burn packages write logs to your temp. directory. So look in there if it still fails.

WiX Bundle upgrade: a new version of MSI is installed before the old version is removed

I have a WiX bundle that installs an MSI and also checks if .NET is installed. Everything works as expected when installing the bundle (and the installer).
My problem is when the bundle is upgraded. In an upgrade, the bundle first installs v_Next of the MSI and when then unininstalls v_Previous of the MSI.
How can I change this order? I want that in an upgrade the v_Previous of the MSI is uninstalled before the v_Next is installed.
Below is my bundle:
<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="MyProductName"
Version="1.0.0.0"
Manufacturer="MyCompanyName"
UpgradeCode="4abf3f67-1234-35b1-b2c1-dd7649b60e1d">
<BootstrapperApplicationRef
Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
SuppressOptionsUI="yes"
LicenseFile="License.rtf"
ThemeFile="Theme.xml"
LogoFile="MyProductName.png"
/>
<Payload
Name="BootstrapperCore.config"
SourceFile="BootstrapperCore.config"/>
<Payload
SourceFile="NetfxLicense.rtf"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef
Id="Netfx4Full"/>
<MsiPackage
Compressed="yes"
SourceFile="$(var.SolutionDir)\Setup\MyProductName.msi"
Vital="yes">
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<WixVariable
Id="WixMbaPrereqPackageId"
Value="Netfx4Full" />
<WixVariable
Id="WixMbaPrereqLicenseUrl"
Value="NetfxLicense.rtf" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup
Id="Netfx4Full">
<ExePackage
Id="Netfx4Full"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="$(var.SolutionDir)\packages\dotNetFx40_Full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)"/>
</PackageGroup>
</Fragment>
</Wix>
Thank you Rob for the answer. I'm trying to do that, but it's not working (I'm surelly missing something)... This is what I have in the MSI:
<Product Id="*"
Name="MyProductName"
Language="1033"
Version="1.0.0.0"
Manufacturer="MyCompanyName"
UpgradeCode="aa027fd0-5111-1236-9af6-55581a588123">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of MyProductName is already installed."
AllowDowngrades="no"/>
<MediaTemplate />
<Feature Id="ProductFeature"
Title="MyProductName"
Level="1">
<ComponentRef Id="ApplicationShortcut" />
<ComponentGroupRef Id="AllFiles" />
</Feature>
</Product>
If I run the v_previous MSI and then v_Next MSI (separatelly, not within the bundle) I get both installed, so no upgrade is being performed. What Am I doing wrong?
Nevermind, MajorUpgrade is working. My version numbering was wrong in the vNext MSI. I need now to also add minor upgrade support.
Upgraded bundles are always uninstalled last today**. To remove v_Previous.msi before v_Next.msi, have the v_Next.msi major upgrade (see the MajorUpgrade element) the v_Previous.msi.
** I think there is a feature request to allow other placements but no one has implemented that yet.

wix installer 3.7 bootstrapper Registry search

<?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"
xmlns:netfx='http://schemas.microsoft.com/wix/NetFxExtension'>
<Bundle Name="IPDev" Version="0.6" Manufacturer="MYAPP Corporation" UpgradeCode="f380ae43-5df1-4cfe-9297-526e3e638e57">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="Netfx45FullPackage"/>
</Chain>
</Bundle>
<Fragment>
<!--checking for matlab 2012a installation-->
<util:RegistrySearch Id="MatlabPath"
Variable="UniqueId"
Root="HKLM"
Key="SOFTWARE\MathWorks\MATLAB\4.17\"
Result="exists"
Win64="yes"
/>
<!--checking for matlab MCR 2012a 64 bit installation-->
<util:RegistrySearch Id="MatlabMCRPath"
Variable="UniqueId"
Root="HKLM"
Key="SOFTWARE\MathWorks\MATLAB Compiler Runtime\7.17\"
Result="exists"
Win64="yes"
/>
<PackageGroup Id="Netfx45FullPackage">
<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
SourceFile="..\SetupProject\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"))"/>
<ExePackage Id="MatlabMCR2012a64" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
SourceFile="..\SetupProject\MCR_R2012a_win64_installer.exe"
InstallCondition="(NOT MatlabPath) OR (NOT MatlabMCRPath)"/>
<MsiPackage Id="IPDev" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="..\SetupProject\bin\Release\IPDevSetup.msi"/>
</PackageGroup>
</Fragment>
</Wix>
here's my code:
my problem is that .NET4.5 is installed only if it exists.
however MATLAB's MCR is installed whether it exists or not.
can you please tell me what's wrong with my condition:
InstallCondition="(NOT MatlabPath) AND (NOT MatlabMCRPath)"
fix after Rob's answer:
DetectCondition="MatlabMCRPathExists OR MatlabPathExists"
this condition should be false in order to install
Here is my final and working code:
this code check's for .NET 4.5 installation.
and for Matlab R2012a or Matlab MCR R2012a.
<?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"
xmlns:netfx='http://schemas.microsoft.com/wix/NetFxExtension'>
<Bundle Name="IPDev" Version="0.6" Manufacturer="Intel Corporation" UpgradeCode="f380ae43-5df1-4cfe-9297-526e3e638e57">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="Netfx45FullPackage"/>
</Chain>
</Bundle>
<Fragment>
<!--checking for matlab 2012a installation-->
<util:RegistrySearch Id="MatlabPath"
Variable="MatlabPathExists"
Root="HKLM"
Key="SOFTWARE\MathWorks\MATLAB\4.17"
Result="exists"
Win64="yes" />
<!--checking for matlab MCR 2012a 64 bit installation-->
<util:RegistrySearch Id="MatlabMCRPath"
Variable="MatlabMCRPathExists"
Root="HKLM"
Key="SOFTWARE\MathWorks\MATLAB Compiler Runtime\7.17"
Result="exists"
Win64="yes" />
<PackageGroup Id="Netfx45FullPackage">
<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
SourceFile="..\SetupProject\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"))"/>
<ExePackage Id="MatlabMCR2012a64" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
SourceFile="..\SetupProject\MCR_R2012a_win64_installer.exe"
DetectCondition="MatlabMCRPathExists OR MatlabPathExists"/>
<MsiPackage Id="IPDev" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="..\SetupProject\bin\Release\IPDevSetup.msi"/>
</PackageGroup>
</Fragment>
</Wix>
The InstallCondition attribute is used to determine whether a package should be installed on the machine. If true, the package is allowed to install. If false, the package is uninstalled. What you want is a DetectCondition attribute to determine whether the package is already present on the machine.
The fix is probably just to change the Matlab ExePackage/#InstallCondition to a ExePackage/#DetectCondition.
You can correct your RegistrySearch call like below:
<!--checking for matlab 2012a installation-->
<util:RegistrySearch Id="MatlabPath"
Variable="MatlabPathExists"
Root="HKLM"
Key="SOFTWARE\MathWorks\MATLAB\4.17\"
Result="exists"/>
<!--checking for matlab MCR 2012a 64 bit installation-->
<util:RegistrySearch Id="MatlabMCRPath"
Variable="MatlabMCRPathExists"
Root="HKLM"
Key="SOFTWARE\MathWworks\MATLAB Compiler Runtime\7.17\"
Result="exists"/>
<PackageGroup Id="Netfx45FullPackage">
This search sets the search result to the variable MatlabPathExists and MatlabMCRPathExists.
Then your condition check should be like following using those variables:
DetectCondition="(NOT MatlabPathExists) OR (NOT MatlabMCRPathExists)"