Wix Bootstrapper Uninstallation - wix

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>

Related

How to conditionally install third party applications in WiX Bundle

I have a WiX installer and I have created a bootstrapper project for the same in order to install my pre requisites. However, I would like pre-requisites to only get installed if they are not already there on the system. Is it possible to add such a condition to my code?
This is the code I have right now, where in it installs my application. But I would like to add the conditions to it.
<Fragment>
<PackageGroup Id="OpenTAP">
<ExePackage
SourceFile="..\..\..\External\Prerequisites\OpenTAP\ITS_OpenTap.9.18.5_Installer.exe"
DetectCondition="ExeDetectedVariable"
InstallCommand="/q /ACTION=Install"
RepairCommand="/q ACTION=Repair /hideconsole"
UninstallCommand="/q ACTION=Uninstall /hideconsole" />
</PackageGroup>
</Fragment>
The ExePackage will only install if the DetectCondition is false. So, as long as you are setting the ExeDetectedVariable correctly then Burn will behave exactly as you desire.

Permissions problem with Wix Custom Action and Burn bootstrapper

I have a package that needs to be installed with elevated administrator privileges. However, this installer includes an uninstall custom action to run a clean-up executable, which must be run as the local user.
This all works fine for the generated MSI (install and uninstall), but when I wrap the MSI up in a Burn bootstrapper, the uninstall custom action is instead run as the administrator - and hence fails...
My application must be installed “perMachine”, and so in my Product.wxs I have my package setup with
InstallPrivileges="elevated"
InstallScope="perMachine"
However, this application's uninstaller includes an uninstall custom action to run a clean-up executable, which must be run as the local user (since it looks for a file in the user’s App-Data). So I’ve set the CustomAction to
Impersonate="yes" Execute="immediate"
And have:
<InstallExecuteSequence>
<Custom Action="UninstallCleanup" Before="RemoveFiles">
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
</Custom>
</InstallExecuteSequence>
This builds my MSI file, which I can then install on my machine. When I then run the uninstall, either via the Control Panel or manually (msiexec /x MyInstaller.msi /l* Testing.log), I am prompted for an admin password, the application is uninstalled, and the custom action is run as the local user. Everything perfect.
BUT I need to wrap this MSI up in a WiX Burn bootstrapper EXE that also installs pre-requisites (the VC runtime) before running my MSI package. Now when this Package Bundle is installed, and then uninstalled via the control panel, my MSI uninstall custom action is run as the administrator rather than the local user - and so fails.
In my Bundle.wxs file I have:
<PackageGroup Id="PP_Package">
<MsiPackage
Compressed="yes"
EnableFeatureSelection="no"
SourceFile="$(var.PP_MSI_PATH)"
Permanent="no"
DisplayInternalUI="no"
Visible="no"
Vital="yes">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
</MsiPackage>
</PackageGroup>
And
<PackageGroup Id="VCRedist">
<ExePackage Id="vcRedist_x86"
Cache="yes"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="$(var.VCREDIST_X86_LOC)\$(var.VCREDIST_X86_FILE)"
Name="Redist\$(var.VCREDIST_X86_FILE)"
InstallCommand="/install /quiet /norestart"
Protocol="burn">
<ExitCode Value="1638" Behavior="success" />
<ExitCode Value ="3010" Behavior="forceReboot" />
</ExePackage>
</PackageGroup>
And then:
<Chain>
<PackageGroupRef Id="VCRedist" />
<RollbackBoundary Vital="yes" />
<PackageGroupRef Id="PP_Package" />
</Chain>
What have I got wrong? Is the issue something like: WiX Burn detects that the MSI is perMachine and so starts it using elevated admin, so that the custom action interprets Impersonate="yes" as meaning the administrator rather than the local user?
Any help, explanations and solutions would be most welcome.

How to add a dependent folder for a Wix burn bootstrapper exepackage

I am new to Wix burn bootstrapper so pardon my ignorance.I have a requirement where i need to install a pre-requisite using burn bootstrapper.
The prerequisite is a setup.exe(third-party) which has dependency on files and a folder(containing couple of files).All these need to exists in the root of setup.exe for the setup.exe to run successfully.
example structure--
setup.exe
samplefile.rsp
files(this is a folder which contains files needed by setup.exe)
Data1.cab
Clientruntime.msi
anotherfile
Here is what i got so far.
<ExePackage Id="Ingres_Client"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="setup.exe"
InstallCommand="/r sampleCR.rsp"
InstallCondition="(VersionNT > v5.1 OR VersionNT64 > v5.1)"
DetectCondition="Ingres">
</ExePackage>
I tried to include the nesessary files using PayLoad.But i cant figure out how to add a folder('files' folder) as it is as a requirement for the setup.exe
Any help is appreciated.
Use the Name attribute of child Payload elements.
<ExePackage SourceFile="setup.exe">
<Payload SourceFile="samplefile.rsp" />
<Payload SourceFile="anotherfile" />
<Payload Name="files\data1.cab" SourceFile="files\data1.cab" />
<Payload Name="files\clientruntime.msi" SourceFile="files\clientruntime.msi" />
</ExePackage>
If there are lots and lots of files, it's probably better to just make a self extracting zip archive.

Create a Single MSI installer

I have developed a application which is in a 32-bit and 64-bit format. These applications require corresponding registry entries as well. I am delivering these as separate packages for 32-bit and 64-bit using WiX.
Now my requirement is to create a single installer which installs the components based on OS configuration. I tried using Bootstrapper to bundle my packages.
My bootstrapper code looks as below:
<Bundle Name="Bootstrapper" Version="1.0.0.0" Manufacturer="MYCOMPANY" UpgradeCode="b24f74ca-883c-4572-9479-37d92d733aa0">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<ExePackage Id="source1" Compressed="yes" PerMachine="yes" SourceFile="32\Sample.exe" InstallCondition="Not VersionNT64" />
<ExePackage Id="source2" Compressed="yes" PerMachine="yes" SourceFile="64\Sample.exe" InstallCondition="VersionNT64" />
</Chain>
</Bundle>
My bootstrapper output is MSI. When I run the MSI I am getting MainEngineThread is returning 1620 in the verbose log.
Please suggest how can I bundle two EXE's to get single MSI package.
Error 1620 isn't particularly nasty - it just means it can't open the MSI file, and the simplest explanation for that is that your directory structure is incorrect and the exe is calling the MSI install with the incorrect location or name for the MSI file.

Referencing a compressed payload for the managed bootstrapper application prerequisite eula

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?