How to add application version to the MSI file properties? - wix

I have a application which is using Wix to create installer. Is there a way to add version number (build number) to the properties of MSI as shown below
Here google chrome installer added version in comment section.

The properties in the details is known as the SummaryInformationStream and can be set via various attributes on the Package element. In this case it's the Comments attribute.
Please note that this field is not the actual version of the MSI. That will always be the ProductVersion property as set by the Product element's Version attribute.

Related

Set ProductVersion dynamically while installing msi

I have a windows setup project in VB.Net (in VS 2010). The ProductVersion is set to default(1.0.0.0) when I build the MSI.
Now I want to set the ProductVersion dynamically while installation (with the help of a custom action or something like that) reading from a database table, so that after installation of the msi, the Version of the product shown in windows control panel or installed exe file properties, is the updated one.
Thanks in advance.
You can't do that - the ProductVersion is something that Windows uses before it even starts the install. That's why you sometimes see "another version of this product is already installed". The easiest way for someone else to change the ProductVersion after your build and before the install is to use a script to update ProductVersion in the Property table of the MSI. If you look at WiRunSQL.vbs in the Windows kit SDK and know the SQL to use that'll do it. You'd need to update Property.ProductVersion. Docs here with a link to examples:
https://msdn.microsoft.com/en-us/library/aa372021(v=vs.85).aspx

replace an application using wix

I maintain two flavors of an application. Only one should be installed on each machine.
Let's say that I got application A installed on a machine. Now the user wants to install application B. The installer should replace A and install B.
Is it possible to tell the windows installer via WIX to silently replace another application?
You can actually do this via the same mechanism that supports a major upgrade. Give each MSI a unique UpgradeCode. Then add an Upgrade element that detects the other MSIs UpgradeCode. Then add an UpgradeVersion element that will detect the other MSIs version correctly (could be the version number). You can use the Property attribute from the UpgradeVersion element to display special UI or otherwise condition stuff in your MSI to say, "Hey, I detected the other application".
I would suggest using the WiX bootstrapper functionality called Burn. You can create a bootstrapper (setup.exe) containing the logic for what packages need installed/removed.

How specify a custom action to only run for upgrading from certain version in a windows installer?

Is there a way to check for the product version that windows installer is upgrading from, such that, a specified custom action only runs on upgrades from certain versions?
Thanks.
Yes you can create a file search that will check for a specific version and set a property you can use in your custom action condition. See http://wix.sourceforge.net/manual-wix3/check_the_version_number.htm for a nice guide.
You need to defined your upgrade rule, using a a custom public property, here are more details: How to implement WiX installer upgrade?
Then use this property to create the condition desired.

Windows MSI Installer via Wix 2 : Can 'OnlyDetect' be dynamic, allowing optional upgrade?

My company uses Wix 2.0 in the build chain.
When our users try to install a later build over an older one, the old build is replaced IF the major version number is the same. Otherwise, we let them have a side-by-side install so they can evaluate the new version before buying (no charge for minor version number updates).
However, I'd like to offer the user the choice of replacing any previous version.
From what I know of Wix, this would mean making the OnlyDetect attribute of the UpgradeVersion element dynamic somehow.
Is this possible without a custom action that hacks the table? The msi will be launched from a .exe gui so I can set properties and the like.
You don't want to use OnlyDetect. You author the Upgrade element (or use the helper MajorUpgrade element if using WiX v3.5+) to do the upgrade and then condition the RemoveExistingProducts action. No hackery necessary.

WIX dynamically set install path according to registry key

I am using WIX to generate an MSI to install an application. I want the application to be installed in a subfolder of a previously installed application. The issue is that the path for this previously installed application can be changed at install time (the UI provides a directory selection dialog); the path is however saved in a registry key. How can I get the value of this registry key and use it as TARGETDIR value for my new application?
I'd use a ComponentSearch and set the result in TARGETDIR using a custom action.
You should take a look at the RegistrySearch element. And by the way, this paragraph of the WiX tutorial describes the approach you should follow in such situations.
Hope this helps.