Back to Salt

How to build the msi

pkg/windows/msi/README-how-to-build.md

2019.83.3 KB
Original Source

How to build the msi

Build client requirements

The build client is where the msi installer is built.

You need

  • 64bit Windows 10
  • Git repositories salt, salt-windows-nsis and salt-windows-msi
  • .Net 3.5 SDK (for WiX)<sup>*</sup>
  • Wix 3<sup>**</sup>
  • Build tools 2015<sup>**</sup>
  • Microsoft_VC143_CRT_x64.msm from Visual Studio 2015<sup>**</sup>
  • Microsoft_VC143_CRT_x86.msm from Visual Studio 2015<sup>**</sup>

Notes:

  • <sup>*</sup> build.cmd will open optionalfeatures if necessary.
  • <sup>**</sup> build.cmd will download them to .\_cache.dir and install if necessary.

Step 1: build the Nullsoft (NSIS) exe installer or use the mockup

  • Build the Nullsoft (NSIS) exe installer

  • Or execute test-copy_mock_files_to_salt_repo.cmd for only testing configuration

Step 2: build the msi installer

Execute

build.cmd

Remark on transaction safety

  • Wix is transaction safe: either the product is installed or the prior state is restored/rolled back.
  • C# is not.

Directory structure

  • Product.wxs: main file.
  • CustomAction01/: custom actions in C#
  • *-discovered-files.wxs: TEMPORARY FILE

Naming conventions

  • Immediate custom actions serve initialization (before the install transaction starts) and must not change the system.
  • Deferred custom action may change the system but run in a "sandbox".
PostfixExampleMeaning
_IMCACReadConfig_IMCACImmediate custom action written in C#
_DECACWriteConfig_DECACDeferred custom action written in C#
_CADHWriteConfig_CADHCustom action data helper (only for deferred custom action)

"Custom action data helper" send properties to the deferreed actions in the sandbox.

Other Notes

msi conditions for install, uninstall, upgrade:

Install sequences documentation:

The Windows installer restricts the maximum values of the ProductVersion property:

  • major.minor.build
  • 255.255.65535

Therefore we generate an "internal version":

  • Salt 3002.1 becomes 30.02.1

Which Python version uses which MS VC CRT version

  • Python 2.7 = VC CRT 9.0 = VS 2008
  • Python 3.6 = VC CRT 14.0 = VS 2017