Wix installer install .net if not installed - wix

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.

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 detect .NET 4.5.2 in bundle

I am trying to make an installer bundle for .NET 4.5.2.
I followed these instructions, and it works fine for that .NET version.
But when I change the version, as below, it does not detect the installed .NET version when I run the installer for the second time:
<ExePackage Id="Netfx452" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q /norestart"
SourceFile="$(var.ProjectDir)Resources\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
DetectCondition="(Netfx4FullVersion="4.5.51209") AND (NOT VersionNT64 OR (Netfx4x64FullVersion="4.5.51209"))"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion="4.5.51209" OR Netfx4x64FullVersion="4.5.51209"))"/>
This is only supported in WiX 3.9:
Include a reference to WixNetFxExtension.dll
In your Bundle.wxs file, add the following to your <Bundle><Chain> element
<PackageGroupRef Id="NetFx452Redist" />
Alternatively, substitute any of the following for the Id attribute's value:
PackageGroup ID Description
NetFx452Web .Net Framework 4.5.2 web setup.
NetFx452Redist .Net Framework 4.5.2 standalone setup.
Here is a short example of final markup:
<Bundle Name="My App" Version="1.0.0.0" Manufacturer="Me" UpgradeCode="{YOUR-GUID-HERE}">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
<Chain>
<PackageGroupRef Id="NetFx452Redist" />
<MsiPackage SourceFile="$(var.AppInstaller.TargetPath)" />
</Chain>
</Bundle>

How to check and install required .net version while installing bootstrapper application

Following is the code for my bootstrapper application:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="BootstrapperSetup" Version="1.0.0.0" Manufacturer="Company" UpgradeCode="XYZ">
<Chain>
<ExePackage SourceFile="C:\SW\XYZ.exe" Compressed="yes"></ExePackage>
<MsiPackage SourceFile= "C:\SW\ABC.msi" Compressed="yes" DisplayInternalUI="yes"/>
<MsiPackage SourceFile="C:\SW\PQR.msi" Compressed="yes" Name ="INSTALLDIR"/>
</Chain>
</Bundle>
</Wix>
Before installing all the 3 packages, I want to check weather .net framework is installed on the machine or not, and if not, then i need to install it from another folder.
Please help me to do the needful.
Depending on the version of .NET you need you can add something like this to your chain:
<PackageGroupRef Id="NetFx40Redist" />
See here for other alternatives: http://wix.sourceforge.net/manual-wix3/wixnetfxextension.htm.
This article talks abut Managed UX and Adding .net for same http://blogs.msdn.com/b/heaths/archive/2011/10/28/introducing-managed-bootstrapper-applications.aspx

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.