How do I create a Visual Studio project for existing Wix v3 code?

44 Views Asked by At

We have Wix v.3 code which we have been using for years (with tweaks for each version) to build our installer. Up to now, it has been done in a Windows command shell, not as part of a Visual Studio project.

Now we would like to upgrade to Wix v.4, and on the Get started with WiX page, I see the following options for using v.4:

  • Command-line .NET tool
  • MSBuild on the command line and CI/CD build systems
  • Visual Studio

I believe the second option is most like what we have been doing.

Previously, I was told the best way to migrate our code from v.3 to v.4 was to use the migration tool HeatWave. But we can only use that with a Visual Studio project.

Currently, our installer code consists of 6 .wxs files, 2 .wxl files, 2 .xslt files, an .html file and an .xml file. So far I have created a Visual Studio project for our installer Setup, and I have added all of these files to the project.

Up to now, to build our installer from the command shell, we use the NAnt tool, and we pass it a .build file and a target (Daily Build, Release Build, Test Build, etc.). The build file sets up environment variables, build paths, appropriate icons, and then specifies what steps to follow to build each target.

For a given target, we may:

  • obtain the latest product code files from GitHub
  • ensure that we have the correct version of .NET on hand
  • delete files from the output folder
  • ensure that we have the necessary nuget packages on hand
  • build the product code (using msbuild)
  • build some data files
  • copy the product files to an installation folder
  • build the installer
  • copy the installer files to another folder

There's a lot of logic in this .build file. How do I get this logic into Visual Studio (or should I?).

Building the installer itself requires several steps, including:

  • setting the UPGRADECODEGUID
  • set the location containing several merge modules
  • harvesting the application files
  • harvesting the data files
  • using candle to process the Wix code
  • using light to combine the processed Wix code into an .msi
  • using signtool to certify the installer
  • deleting the temporary files

All of these steps are done in a Windows batch file (.bat), which is invoked by the .build file. How do I represent this logic in a Visual Studio Setup project?

Note: we want to be able to run all of this on a CI/CD system (TeamCity) as well as from the Windows command line.

(We also do a bootstrap process, so we can distribute patches for our product, but that is another question for another post...)

Thanks in advance for any strategies you can offer for how to set this up in Visual Studio.

0

There are 0 best solutions below