共用方式為


Visual studio only allows Product Version Property format in form of ##.##.#### only. For forth field it would give Build error for setup Project

Windows Installer Product Version Property only allows the format major.minor.build

 

However general MSI build application would use the Four field Product version

Considering major.minor.Build.Revision, the forth field however is insignificant to MSI

 

Workaround

 

1. we could manually open the MSI file using Windows Installer Database Editor Tool ORCA and change the Product version Property

 

2. we can automate it using Visual studio, we would need to create Post build event like this

cscript //nologo "$(ProjectDir)WiRunSql.vbs" "$(BuiltOuputPath)" "UPDATE `Property` SET `Value`=’x.x.x.x' WHERE `Property`='ProductVersion'

(Where “ x” is any Integer Value)

 

Select Visual studio setup Project and PostBuild event from Properties, add the above script in Post build event

we would need to place WiRunSql.vbs under Solution folder to run this event (to get this VBS file please Install Windows Installer 4.5 SDK )

 


CONTENT : Gaurav Bodar


REVIEW : Ravi Shankar

Comments

  • Anonymous
    August 08, 2013
    When I call it from the Post-Build event it fails with Error 1 'PostBuildEvent' failed with error code '2' 'Unspecified error' My Post-Build event looks like: cscript "$(ProjectDir)WiRunSql.vbs" "$(Configuration)Setup.msi" "UPDATE Property SET Value='1.2.7' WHERE Property='ProductVersion'" In Visual Studio, I right-clicked the solution and clicked "Add existing item" and added the WiRunSql.vbs. When I run the command in the command prompt it works fine.

  • Anonymous
    July 03, 2014
    This format works for me: cscript "$(ProjectDir)WiRunSql.vbs" "$(BuiltOuputPath)" "UPDATE Property SET Value='1.0.0.0' WHERE Property='ProductVersion'"