1

I would like to create a setup project based on WiX which does the following (as well as creating the installation package):

  • callable from msbuild running on a CI build server (Hudson)
  • take a version number from some asset in either the setup project or the main assembly
  • take the current build number from the CI system
  • create a full product version number [version].[build] such as 1.3.432
  • store this value in an asset (e.g. the main assembly) is such a way that it can be read out at run time and displayed on the splash window

I have tried a number of approaches and googled a lot but have not found a workable solution. Can anyone help?

paul
  • 13,312
  • 23
  • 81
  • 144
  • You can check my answer here: http://stackoverflow.com/questions/1160/use-svn-revision-to-label-build-in-ccnet/12481921#12481921 – granadaCoder Mar 14 '13 at 19:15

1 Answers1

2

The WiX toolset does this by creating a version.cs, a version.h and a version.wxi during the MSBuild then including those files in all the projects. That way our executable can print out their version when you run something like candle.exe -? and all of the bundles and .msi packages have their versions set correctly.

You can see how we do this in tools\WixBuild.Version.targets (here). It would straight forward to override the properties in WixBuild.Version.targets with properties passed via the command-line to MSBuild via Hudson if you wanted.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
  • 1
    I believe this is the updated link for GitHub: https://github.com/wixtoolset/wix3/blob/develop/tools/WixBuild.Version.targets – reduckted Jan 06 '21 at 02:59