Avishek
Avishek

Reputation: 1896

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.

Upvotes: 0

Views: 443

Answers (1)

PhilDW
PhilDW

Reputation: 20780

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

Upvotes: 1

Related Questions