Referencing a compressed payload for the managed bootstrapper application prerequisite eula - wix

I'm building a setup bundle which needs to work in a non-internet connected environment, so I am including the .NET 4.0 framework installer, and its corresponding eula in the bundle. I copied the source from wix37-sources\src\ext\NetFxExtension\wixlib\NetFx4.wxs but with some modifications so that the package is compressed instead of a remote payload.
However, I haven't been able to figure out how to make the eula link load the payload from the bundle. I always get:
[0930:0BDC][2013-08-22T16:02:37]e000: Error 0x80070002: Failed to launch URL to EULA.
Here's the wix source:
<!-- Referencing the NetFx40Full package will cause these WixVariables to be defined -->
<!-- which indicates to the bootstrapper engine what the MBA dependency is -->
<WixVariable Id="WixMbaPrereqPackageId" Value="NetFx40Full"/>
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetFX_4_all_FINAL_RTM.rtf"/>
<PackageGroup Id="NetFx40Full">
<ExePackage
Id="NetFx40Full"
InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]""
RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]""
UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]""
PerMachine="yes"
DetectCondition="NETFRAMEWORK40"
Vital="yes"
Permanent="yes"
Protocol="netfx4"
SourceFile="$(var.SourceRoot)\Deployment\Packages\.NET Framework 4.0\dotNetFx40_Full_x86_x64.exe"
Compressed="yes">
<Payload SourceFile="$(var.SourceRoot)\Deployment\Packages\.NET Framework 4.0\NetFX_4_all_FINAL_RTM.rtf"
Compressed="yes"/>
</ExePackage>
</PackageGroup>
Is this actually possible?

Related

Wix bootstrapper and trying to install an exe that has multiple files

I am trying to get Wix to install https://www.silabs.com/documents/public/software/CP210x_Windows_Drivers.zip
It is basically an exe that has multiple files and folders that are required for the installation to work.
I have added this this to Bundle.wxs in the Bootstrapper.
<Fragment>
<PackageGroup Id="WindowsCP210xVCPInstallerx64" >
<ExePackage
Id="WindowsCP210xVCPInstallerx64"
Name="$(var.PackagePath)\CP210xVCPInstaller_x64.exe"
DisplayName="CP210x USB to UART Bridge Virtual COM Port (VCP) drivers"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
InstallCondition="VersionNT64"
InstallCommand="/Q /SW /SE"
RepairCommand="/Q /SW /SE"
UninstallCommand="/U $(var.PackagePath)\CP210x_VCP_Windows\slabvcp.inf /Q"
SourceFile="CP210xVCPInstaller_x64.exe">
</ExePackage>
</PackageGroup>
</Fragment>
However when building I keep getting this error
The system cannot find the file 'CP210xVCPInstaller_x64.exe'.
At present I have just added the entire folder that contains the CP210xVCPInstaller_x64.exe and all the other files it depends on into the project.

Wix: The system cannot find the file 'SourceDir'

I was damned to build an setup using wix and wixtoolset 3.11. Yes, its the hell. Doing simple things with this toolset and reading the manual consumes much time and money.
My goal: The setup should download and install the .NET Framework 4.5. Here is the declaration:
<?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:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<?include ApplicationData.wxi?>
<Fragment>
<WixVariable Id="NetFx45WebInstallCondition" Value="" Overridable="yes" />
<!-- install dotnet framework -->
<!-- https://stackoverflow.com/questions/42720958/web-download-of-vcruntime140-with-wix-burn/42726779 -->
<PackageGroup Id="NetFx45Web">
<ExePackage
InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx45FullLog].html""
RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]" /log "[NetFx45FullLog].html""
UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx45FullLog].html""
PerMachine="yes"
Id="NetFx45Web"
Cache="yes"
Permanent="yes"
Vital="yes"
Protocol="netfx4"
DownloadUrl="https://www.microsoft.com/de-ch/download/confirmation.aspx?id=30653"
DetectCondition="false"
Compressed="no"
InstallCondition="!(wix.NetFx45WebInstallCondition)"
Name="Framework\dotNetFx45_Full_setup.exe"
/>
</PackageGroup>
</Fragment>
</Wix>
I do not want to embed any .NET Framework installer into my setup, but for whatever reason, one of the attributes 'Name' or 'SourcePath' is required. Either I use the attribute 'SourcePath' or 'Name', both declarations need a path to an existing file. Yes, of course, thats true. That´s Wix.
When I use 'SourceFile' to a path, then the compiler in Visual Studio runs successful, but on the target system, where the DotNet Framework 4.5 is not installed, nothing happens. No Framework will be installed. Okay, then I tried the attribute 'Name' instead and passing the value 'Framework\dotNetFx45_Full_setup.exe'. When compiling the setup, I get the following error:
The system cannot find the file 'SourceDir\Framework\dotNetFx45_Full_setup.exe'
Hmm... What the hell is SourceDir, why do I need to delcare a path either I want that the setup downloads the file? Many questions, but let´s begin with the first one:
How can I fix the problem regarding the misterious 'SourceDir'?
You should replace the PackageGroup element with a PackageGroupRef element.
http://wixtoolset.org/documentation/manual/v3/xsd/wix/packagegroupref.html
You will need to add a reference to the NetFxExtension ( WixNetFxExtension.dll ) because the extension provides this definition at build time. You can do this in Visual Studio / Votive by adding a reference to the project or by adding it to your light.exe call. See:
http://wixtoolset.org/documentation/manual/v3/customactions/wixnetfxextension.html
<?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:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="ProductName1" Version="1.0.0.0" Manufacturer="ProductName1" UpgradeCode="f6ac65f9-56ca-496c-b04c-b68b37967298">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="Resources\EULA.rtf" LogoFile="Resources\Icon.png" />
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx45Web"/>
<MsiPackage Id="ProductName1" SourceFile="$(var.ProductName1Setup.TargetPath)" />
</Chain>
</Bundle>
</Wix>

Web download of vcruntime140 with wix burn

I want to use the WiX bootstrapper burn to automatically download and install the vcruntime140 package (Visual C++ Redistributable for Visual Studio 2015) if it is required.
It's trivially easy to do this for the .NET frameworks:
<Chain>
<PackageGroupRef Id="NetFx452Web"/>
...
</Chain>
but I can't find an equivalent for the vcruntime packages. (Is that because there isn't one, or am I just typing the wrong keywords into Google?)
Just to be clear: I do not want to include the package with my installer. It must be a web download.
There is no PackageGroupRef for the redist as for .net.
But there is 3 other options:
Add a redist exe in your chain. (Not good for you)
Use a redist c++ merge module inside one of your msi's.
Try to write your own web download as .net does. Here is a sample of the .net web download. The full file can be found in the source code of wix by the name "NetFx46.wxs"
<Fragment>
<PropertyRef Id="WIXNETFX4RELEASEINSTALLED" />
<Property Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" Secure="yes" />
<SetProperty Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" Value="1" After="AppSearch">
WIXNETFX4RELEASEINSTALLED >= "#$(var.NetFx46MinRelease)"
</SetProperty>
</Fragment>
<Fragment>
<util:RegistrySearchRef Id="NETFRAMEWORK45"/>
<WixVariable Id="WixMbaPrereqPackageId" Value="NetFx46Web" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="http://go.microsoft.com/fwlink/?LinkID=558772" />
<WixVariable Id="NetFx46WebDetectCondition" Value="NETFRAMEWORK45 >= $(var.NetFx46MinRelease)" Overridable="yes" />
<WixVariable Id="NetFx46WebInstallCondition" Value="" Overridable="yes" />
<WixVariable Id="NetFx46WebPackageDirectory" Value="redist\" Overridable="yes" />
<PackageGroup Id="NetFx46Web">
<ExePackage
InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx46FullLog].html""
RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]" /log "[NetFx46FullLog].html""
UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx46FullLog].html""
PerMachine="yes"
DetectCondition="!(wix.NetFx46WebDetectCondition)"
InstallCondition="!(wix.NetFx46WebInstallCondition)"
Id="NetFx46Web"
Vital="yes"
Permanent="yes"
Protocol="netfx4"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=560371"
LogPathVariable="NetFx46FullLog"
Compressed="no"
Name="!(wix.NetFx46WebPackageDirectory)NDP46-KB3045557-x86-x64-AllOS-ENU.exe">
<RemotePayload
CertificatePublicKey="52868DFCA6E3AF2632389E6C1EE7D0468D3797D0"
CertificateThumbprint="3BDA323E552DB1FDE5F4FBEE75D6D5B2B187EEDC"
Description="Microsoft .NET Framework 4.6 Setup"
Hash="480CA134B9E3F2437DF10719D5A8C77DDEC0A4F1"
ProductName="Microsoft .NET Framework 4.6"
Size="1497400"
Version="4.6.81.0" />
</ExePackage>
</PackageGroup>
Just for the record, here's my final solution.
Right-click on the bootstrapper project References in Visual Studio and add a reference to WixUtilExtension.
Add xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" as an attribute to the top level Wix element.
Add to the <Chain> element:
<PackageGroupRef Id="vcredist_vc140"/>
Add as a child of the <Wix> element:
<Fragment>
<!-- vcredist 2015 x86 -->
<util:ProductSearch
Id="VCREDIST_140_x86"
UpgradeCode="65E5BD06-6392-3027-8C26-853107D3CF1A"
Result="version"
Variable="VCREDIST_140_x86"/>
<PackageGroup Id="vcredist_vc140">
<ExePackage
Id="vc140"
Cache="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Compressed="no"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkID=615459"
Name="vcredist_vc140"
InstallCommand="/quiet /norestart"
DetectCondition="(VCREIST_140_x86 >= v14.0.24215)">
<RemotePayload
Description="Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215"
ProductName="Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215"
Size="14456872"
Version="14.0.24215.1"
Hash="72211BD2E7DFC91EA7C8FAC549C49C0543BA791B" />
</ExePackage>
</PackageGroup>
</Fragment>
UpgradeCode came from this answer and is specific to v14.0.24215 of the vcredist installer. This is how the bootstrapper decides whether it is already installed.
Compressed="no" tells the installer not to include the file in the installer itself (since we want to download it from the web).
DownloadUrl is a direct URL to the downloadable installer from this answer.
RemotePayload Description is the text of the installer's Description resource and likewise ProductName. (It appears that the text does not have to match the text in the resources. ProductName is the description shown in the bootstrapper's progress dialog.)
Size is the size in bytes.
Hash is found with the Powershell command get-filehash -algorithm SHA1 .\vc_redist.x86.exe.
I hope this helps someone.

How to build a bundle without embedding the other installers?

This works for me
<ExePackage Id="Netfx35"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
InstallCommand="/q /norestart /lang:ENU"
RepairCommand="/q /norestart /lang:ENU"
UninstallCommand="/q /norestart /lang:ENU"
DetectCondition="DotNetFramework35SPInstallRegValue"
SourceFile="embed\DotNetFX35SP1\dotnetfx35.exe" />
But it embeds the .NET installer into the bundle package. I want to keep it as a separate file. I'm trying to use the Payload tag, but I don't know if it will work.
Replace Compressed="yes" with Compressed="no" on your Bundle authoring.
You need to make use of the Container element:
Type attribute:
Indicates whether the container is "attached" to the bundle executable
or placed external to the bundle executable as "detached". If this
attribute is not specified, the default is to create a detached
container.

Wix Bootstrapper Uninstallation

I need to programatically access the uninstall location of the bootstrapper. I need this information because some files which will be needed by the packages in the chain during uninstall need to be moved here once all packages are successfully installed.
I might be required to modify the value of UninstallString in the registry to a different location and copy the bootstrapper executable and other required files to this location. Are there any side effects on doing so?
You can add the required files using payload. The files are packed into your boostrapper.exe and available during execution in the same folder your bootstrapper is executed. Add files required by you bootstrapper application to the payload of the bootstrapper application.
<BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<Payload SourceFile='MyBA.dll' />
<Payload SourceFile='BootstrapperCore.config' />
... place additional playload files here ...
</BootstrapperApplicationRef>
You can access them from your bootstrapper code with
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "payloadfilename");
You can also add files to specific packages.
<ExePackage InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]""
UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]"" >
<Payload SourceFile="payloadfilename"/>
</ExePackage>