We're running custom installer logic in a C# class via the System.ComponentModel.RunInstallerAttribute annotation. We use the VS2010 MSI installer.
Problem: this logic is not executed when we do an upgrade. Is there a way to execute code for upgrade installs?
What condition are you using for the custom action? If you are using "Not Installed" is should run.
Also, just to sure I understand the problem correctly. When you do an upgrade the custom action is in the new package, i.e. the one upgrading, not the one being removed?
Related
I want to run a Wix custom action only on upgrade and patches and NOT install/reinstall or repair. So basically only if the version number of the application is increasing should this custom action run. I tried the following rule and it disabled the custom action completely on patching:
<Custom Action="upgrade_action"
Before="InstallFinalize">Installed AND NOT REMOVE AND UPGRADINGPRODUCTCODE</Custom>
What can I do to achieve this?
If this is the new major upgrade product and you are using the WiX MajorUpgrade element then the WIX_UPGRADE_DETECTED property is set if it's doing an upgrade and detecting an older version. UPGRADINGPRODUCTCODE is set in the old product being upgraded, the one that's already installed.
It looks like all you need is WIX_UPGRADE_DETECTED Or PATCH if you want the CA to run on either of those conditions only.
Installer defaults to the Custom install instead of the Full no matter what. In case that there is no solution for that, can I have checked all the components by default in custom install?
If you have installed your application earlier using your setup script and now you are reinstalling, it may be that Setup uses previous type as default.
Please check UsePreviousSetupType parameter for [Setup] Section.
I am trying to create an installer and it will install another *.msi.
But it is failure, because can't install at the same time.
If it is possible to pause main installer and install another msi??
You can do it by creating a bootstrapper package. check this post on how to create a bootstrapper package.
Perhaps you have a custom action to install something else, and that something else is an MSI-based setup, and that nearly always won't work (without going into gory details) or is a really bad idea.
I need to validate the hashcode when building a ClickOnce package - Any way to do this without installing it first? Ideally I would do it in my MSBuild script, right after I have created the package. It doesn't seem that Mage.exe has this ability.
Thanks
you could sign manually by using mage.exe from the Framework tools, there is an cli and an gui version of mage available. I've used the commandline tool for resigning packages while build and it works great, I think the cli should provide a way to validate hashs.
But btw. if you change any file you have to resign the entire package.
We have a software that has couple of executables inside. One of the executables is Windows service, and it doesn't change that often, usually we release many updates to the main executable, but the service version is same inside installer.
When service is installed first time or upgraded with newer version, we need to run custom action. We managed to solve first install part, but we don't know how to determine that version we're installing now is newer than one that already exists. Sort of if(newver > oldver) run custom action.
Thank you in advance
- Jack
You can try using the upgrade rules of your package. More details here: How to implement WiX installer upgrade?
Rob Mensching (the second answer in the linked thread) shows an example for upgrade rules. You should first familiarize yourself with the Upgrade table and how upgrade rules work. There isn't an easy answer or a quick fix for this in WiX.
Basically, you should have 2 upgrade rules
the first sets a property when an older version is found
the second sets another property when a newer version is found
After that you can use the older versions property to condition your custom action. For example, if the property is named OLDERVERSIONFOUND the custom action condition can be:
OLDERVERSIONFOUND
or something like
OLDERVERSIONFOUND > "1.0.0"
Your best bet is to store the "service" version somewhere in the registry, search for that registry value during upgrade and run your CA if newver > oldver (and the CA should also update said registry value to newver)
Note that Custom Actions are (generally) an admission of failure. I always try to separate out the configuration portion of setup to a pre-install (for sysadmins doing deployment) or post-install (for interactive installations) step - often a separate executable.
Declarative installations with no custom actions are much more reliable - if you can figure out how to rewrite the service so that your custom action is no longer required, you'll be much better off in the long term (this doesn't help when you're under pressure to release now, but it's something to think of for future releases)