I have a vbscript to run to create backup of the already installed application.
I have added it in a custom action.
NOT Installed OR UPGRADINGPRODUCTCODE
Problem is during upgrade custom action is running twice..so i will have one more backup folder of previously installed one.
UPGRADINGPRODUCTCODE is not what you want to use. You should use NOT UPGRADINGPRODUCTCODE.
This property is set by the installer when it is running the currently installed version of the msi within the installing MSI's server context. This is what is run when you run "RemoveExistingProducts" during the upgrade. The problem you have now is that your install that you are installing has "NOT Installed" = true and "UPGRADINGPRODUCTCODE" = false. When the installer runs the previous install to remove it this install has "NOT Installed" = false but "UPGRADINGPRODUCTCODE" = true so it will run the custom action.
What I would consider setting the condition to would be
WIX_UPGRADE_DETECTED AND NOT UPGRADINGPRODUCTCODE AND NOT REMOVE~="ALL"
Here's some info on the WIX_UPGRADE_DETECTED property
So this condition will only run when the install detects a previous version and we are upgrading but will not run when we are just removing the old version and will not run when uninstalling. I would also schedule RemoveExistingProducts afterInstallInitialize so that your backup is created at the earliest point during the server context of the MSI installation before any files are removed or updated.
Related
I am learning windows installer xml(WIX) and have a condition in my code which checks if software-A is installed before my software is installed.
I want my software could be installed when software-A has been installed but when I am uninstalling my software, this condition should not be triggered.
The bundle works fine when it is in the installing process, that means if software-A has already been installed, it will continue to install. But if software-A has not been installed at all, the bundle will trigger condition checking process, show the condition message and stop installing. I have tried two conditions "NOT Installed" and "Installed", but the condition checking process is still triggered all the time even it is in uninstalling process. That means whatever the process is the bundle always searches the same registry.
The logic of the installer is simple enough but I am a beginner on Windows installer xml technology.
<bal:Condition Message="Software-A is Required.">
<![CDATA[NOT Installed OR SoftwareAInstalled]]>
</bal:Condition>
<util:RegistrySearch Id="SoftwareAInstalled"
Root="HKLM"
Key="SOFTWARE\SoftwareA\"
Variable="SoftwareAInstalled"
Result="exists" />
I wanna know how to prevent the checking process when the installer is in the uninstalling. Or any other suggestions would be appreciate.
Since you want to detect the state of your Bundle you should have a look at Burn Built-in Variables. WixBundleInstalled will give you the installation state of the current Bundle. Therefore
WixBundleInstalled OR SoftwareAInstalled
Will allow the installer to continue if either the current bundle is already installed or if you are performing a fresh install of the bundle and Software A is already present.
I don't have time to verify this right now, but it looks like you can use:
Installed OR SoftwareAInstalled
I would uppercase the latter property, but then it can be set at the command line. I guess it should work with what you have. Can't test right now. Tip: Remember to test in silent installation mode, in modify, repair, self-repair, uninstall, major upgrade, etc... Lots to check.
Some previous answers on similar issues:
Check if prerequisites are installed before installing a windows installer package
How to add new framework version in Installment Requirement page of InstallShield?
WIX Installer: Prevent installation on Windows Server 2012 R2 (on how to debug conditions)
Comment on the OR Installed construct
I have a custom action that meant for maintenance of installation:
<Custom Action="caPostMaintenanceConfiguration" Before="InstallFinalize">Installed AND NOT WIX_UPGRADE_DETECTED</Custom>
But this action is being executed during upgrade from original MSI during its uninstall. Is it a bug in Wix infrastructure? Is there a way to have control over that?
Assuming that the custom action is in the originally installed MSI as well as in your upgrade, then it will run during the uninstall of the older product. The condition will evaluate to true because the older product is still installed at the time you are uninstalling it, and WIX_UPGRADE_DETECTED won't be set during the uninstall.
We have a custom WIX bootstrapper installer. Bootstrapper bundle chains 3 individual application msi. Bootstrapper custom UI allows user to choose which application to install and based on the selection custom bootstrapper will install its msi.
Now consider the scenario.
Application, say A1 version 1.0.0.50 is installed in the system. Assume bootstrapper version is also 1.0.0.50
Assume next version of bootstrapper installer with some updates is available, Assume its version is 1.0.0.51.
Using this one I want to install second application , say A2.
Also I want to uninstall A1. Currently we support upgrading A1 to 1.0.0.51 version using this latest installer.
But I want to check the possibility of uninstalling A1 using the latest bootstrapper version. How do I implement it?
Because as per our project requirements, end user should be able to uninstall A1 using any version of bootstrapper.
I have seen in registry it stores the Uninstallstring for each msi. If I run uninstallstring value , for e.g MsiExec.exe /X{90140000-0011-0000-0000-0000000FF1CE}
Will it exactly does what is done by msi uninstall ? will it handle cleaning registry entry entries, deleting installed files etc ?
Don't go to registries for this. MSI database has an upgrade table which will hopefully fulfill your requirement(https://msdn.microsoft.com/en-us/library/windows/desktop/aa372379(v=vs.85).aspx). Add an entry with Upgrade Code of installed MSI, provide version boundaries under VersionMin & VersionMax, set the attribute 769 or something else depending on your requirement, create a new public property and add it to SecureCustomProperties.
Lastly during installation enable windows logging and check the logs for standard actions like findrelatedproducts and removeexistingproducts if you face any issues.
I have created a Wix custom bootstrapper application and bundle file using Wix 3.8. Bundle file contains five MSI packages. Created a setup and installed it. All MSI packages are installed and uninstalled correctly.
Then, I have include "InstallCondition" attribute in each MSI package elements in bundle file. Installed the setup based on the selection (installed three MSI packages). Installation working fine.
Now I want to uninstall any of selected MSI packages from installed packages (three packages installed) using custom BA.
Is it possible do the above using Wix CBA? Please share any idea regarding this.
Thanks
You need to call Plan with the Modify action (or Uninstall if you want to uninstall the whole bundle). Then in the OnPlanPackageBegin callback, set the desired state of the package (Absent to uninstall). I think if the InstallCondition of a package evaluates to false during a Modify or Uninstall action, the engine would plan to uninstall it by default.
I have a Wix project that I have set to allow major upgrades. I'm using WixUI_Advanced for a choice between per-user and per-machine installs. When I install and upgrade per-user everything works as expected, the installer recognizes an upgrade and there is only one entry in Programs and Features. However when I choose a per-machine install, it starts duplicating entries in Programs and Features (even when both install and upgrade are per-machine and to the same folder).
Looking at the install log file it seems that FindRelatedProducts is executing before the user gets a chance to select a per-machine install, so the installer thinks that the context has changed and won't do an upgrade. I attempted to suppress FindRelatedProducts in InstallUISequence but when I do that the installer still skips FindRelatedProducts in the InstallExecuteSequence.
What are my options at this point?
You could manually execute the FindRelatedProducts action again, after the installation context was selected. Use the MsiDoAction method. I used this approach once and it seemed to work.
A better approach would be to run your own custom action before FindRelatedProducts that would search for a previous version of the product already installed. That custom action should set ALLUSERS to either 1 or to Nothing depending on the scope of that previous version, so that FindRelatedProducts finds it and schedules its upgrade. A good idea would then be to disallow selecting the per-user scope for the user if the previous version was installed per-machine - otherwise the installer may have insufficient privileges to upgrade the previous per-machine installation.
This seems to be the approach taken by InstallShield. If you create an empty test MSI package with the free InstallShield Limited Edition and then de-compile it with Dark, you will see that that custom action is called IsSetAllUsers and located in SetAllUsers.dll.