Wix Burn Bundle - Must be Administrator - wix

I've created a WIX Burn Bundle. In the Bundle I install .Net 4 (if its not installed) then 2 more .msi files. 1 is a third part msi the other a msi I created for my software using WIX. I need to be an Administrator on the machine to run these the .msi files.
I want the Burn bundle to not do anything if the user is not an administartor i.e. install nothing. In my product software I can easily do do using below - however I cant do this in the bundle. I've read lots of similar posts but just didnt find a working example for what I want to do.
<CustomAction Id="IsPrivileged" Error="You must be an Administrator to install [ProductName]." />
<InstallExecuteSequence>
<Custom Action='IsPrivileged' Before='LaunchConditions'>
Not Privileged
</Custom>
</InstallExecuteSequence>

You can use the bundle equivalent of launch conditions using Burn's built-in variables and WixBalExtension's Condition element:
<bal:Condition Message="You can't elevate.">
<![CDATA[Privileged <> 0]]>
</bal:Condition>
<bal:Condition Message="You're not elevated.">
WixBundleElevated = 1
</bal:Condition>

Related

How to package vcruntime140.dll for a wix custom action DLL written by native c++?

My wix wxs has a CustomAction written by c++: HSRInstall.dll. Inside this dll, windows swdevice.lib, new.lib are linked. So it requires running with vcruntime140.dll. When user execute this msi package on a clean install windows server 2019 datacenter, without a vcruntime140.dll in C:\Windows\System32, it will fail to be installed.
<Binary Id="HSRInstalldll" SourceFile="HSRInstall.dll" />
<CustomAction Id="deletehsrservicecache" BinaryKey="HSRInstalldll" DllEntry="HSRCustomAction" Execute="deferred" Impersonate="no" Return="ignore" />
When I add vcruntime140.dll as binary element in wxs, its file name is changed when installing. How to add the vcruntime library that the dynamic library depends on to the wix package? Thanks!
The best option is to statically link the C runtime (CRT) into your custom action dll. That way you do not have a dependency outside of your installation package.
We statically link the CRT in all the WiX custom actions.

Launch Firebird 1.5 installer from WIX

I have been tasked with writing a WIX installer from an application that uses Firebird 1.5. The WIX install process must launch the firebird installer if firebird has not already been installed. Using a custom action I get the firebird installer to launch but end up with error "1607 unable to install installshield scripting runtime". I have searched this error but have not been able to find a resolution.
Here is a snipit of my custom action.
<InstallExecuteSequence>
<Custom Action='LaunchFirebirdsetup' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
<CustomAction Id='LaunchFirebirdsetup' FileKey='Firebird15Setup' ExeCommand='' Return="ignore" Execute="commit" Impersonate="no" />
It might be because you cannot run an MSI install from within an MSI install, I think that's still true even with a Commit custom action. Your IS Script install is an MSI install, so that may be the issue. Launching installs from within installs is always an issue. You should use Burn to launch that Firebird install before installing yours. That's what a Burn bundle is for - prerequsites and associated installs as well as your MSI setup. You could use it to install a standalone ISScript MSI, that's another possibility.
The other issue is that some installs just don't work when installed with no impersonation, which means with the system account. There's no indication that you tried to do it silently, which means that it's running with the system account and may attempt to show UI to the interactive user, and that will fail. This another reason to install it with Burn - it will run as the interactive user.
Looks like bootstrapping (burn) is the solution.
Took me a while to get it but after getting it to run, it makes sense I guess.
Instead of running an installer exe you could use merge modules. For instance the Firebird 1.5 Merge Modules from MWA Software. Modules, installation instruction and source for the merge modules are freely available.

Upgrading with WiX Burn does not run upgrade custom actions on individual msi's

EDIT: My custom actions seem to be running well now, but I don't believe I changed any code. Do custom actions run in the order they appear in the wxs file or is their execution order arbitrary?
If I build my product.msi version 1.0.0 and install it, then rebuild it to be product.msi version 1.0.1 and upgrade it, the custom actions get called perfectly.
If I build my product.msi version 1.0.0 and put it into a burn installer version 1.2.0 and install it, then rebuild product.msi version 1.0.1 and put it into burn installer version 1.2.1 and upgrade it, my custom actions do not get called correctly.
Something about the burn bootstrapper is making custom actions not perform identically.
Here are my 4 custom actions. The final two are not being called when running the bootstrapper to update them.
<Custom Action='RemoveServiceWithProvidedBatch' After='InstallInitialize'>Installed</Custom>
<Custom Action='WaitForFileLocks' After='InstallInitialize'>Installed</Custom>
<Custom Action='InstallService' Before='InstallFinalize'>NOT REMOVE ~= "ALL"</Custom>
<Custom Action='MergeConfigFiles' Before='InstallFinalize'>NOT REMOVE ~= "ALL"</Custom>

How do I install drivers using Burn and DPInst after MSI installation?

I have a setup MSI for our application, and I also have signed FTDI drivers that need to be installed as well. I'd like for them to be installed with Burn rather than the WiX MSI to keep CustomActions out of the MSI (however, I've tried the CA route as well).
I've tried putting the instruction in an ExePackage, but the SourceFile attribute asks for the file location during build, not runtime (e.g. <ExePackage Id="InstallDrivers" DisplayName="Installing Drivers" SourceFile="[InstallFolder]Drivers\DPInst.exe" InstallCommand="/SA /SW" PerMachine="yes" After="MyMSISetup" Description="Installing the FTDI drivers needed for device communication." /> doesn't build).
Is there a way to tell Burn to execute DPInst using the file location of where the drivers will be after installation of the MSI? Currently the MSI copies the driver files and DPInst into a Drivers folder in the install directory. After looking online and here on Stack Overflow, I doesn't seem like anyone else is doing this.
I've also tried using the CustomAction route in the MSI, but the CustomAction fails to execute. I'd like the drivers to be installed with Burn, but if they work with the MSI I'd settle for that. Currently the MSI copies the files to the Drivers folder, and the CustomAction looks like this:
<InstallExecuteSequence>
<Custom Action="Install_Signed_Driver" After="InstallFiles">NOT INSTALLED</Custom>
</InstallExecuteSequence>
<Fragment>
<CustomAction Id=Install_Signed_Driver" Execute="deferred" Directory="Drivers" ExeCommand="[Drivers]DPInst.exe" /SW /SA" Return="ignore" />
</Fragment>
As near as I can tell, the custom action never runs. I've even taken off the /SW and /SA switches to see if anything loads, and nothing.
Per StackOverflow's suggestion, I'm posting what I found here. I was never able to get Burn to run DPInst for the driver installation, but was able to get the CustomAction to work using Can't seem to get Wix to install driver.

Uninstall add-on setup when uninstall the Main setup using Wix

I am using wix in my installer,
I need to uninstall add-on Setup while uninstall the Main setup,
I am using the below code in Main setup wix,
<CustomAction Id="UNINSTALL_ADDON" Return="asyncNoWait" Execute="immediate" ExeCommand="msiexec.exe /x [add-onProductID] /qn” Property="add-onProductID" />
Below code in InstallExecute Table
<Custom Action="UNINSTALL_ADDON" Sequence="1282">(REMOVE="ALL")</Custom>
I am using the below property
<Property Id=" add-onProductID" Value="NULL" />
I have read the add-on Property Id from registry and pass it set to add-onProductID using CustomAction while uninstall the main setup.
This won’t help. Could you please help me to solve the issue?
You cannot install or uninstall another MSI during InstallExecuteSequence because Windows Installer doesn't support simultaneous install processes.
A solution is to make sure that your custom action is scheduled after InstallFinalize action (it's sequence is greater than InstallFinalize).