dotNetInstaller is a widely used, general-purpose setup bootstrapper

dotNetInstaller enables the developer to define the application prerequisites and install the correct version(s) of these components in a predictable order based on the processor architecture, user operating system type and language, allow the user to download these components from the web, install these components directly from a single packaged setup, local media or both. dotNetInstaller is very feature rich and runs on all known Windows operating systems with a very tiny footprint.

A boostrapper doesn’t replace tools like InstallShield, Wise, Visual Studio Setup and Deployment Project or Wix. The goal is to create an application to help users with installing the correct prerequisites. Most real world applications need to install several components to work properly, including Windows Service Packs, Internet Explorer, MDAC or .NET Framework. This kind of applications are most commonly known as bootstrappers. dotNetInstaller is such a bootstrapper.

http://dotnetinstaller.codeplex.com/

Common setup mistake (please do not remove generated content on upgrade)

By default, Windows Installer never deletes files it doesn’t know of (user files, generated by setup custom action files).

There are big temptation to write uninstall custom action which deletes all files to make directory clear after product deletion.

Please think about upgrade even you working on the first version of your product.

<Custom Action=”REMOVEDIRS” Before=” InstallFinalize”>REMOVE=”ALL”</Custom> – Incorrect (the product customization will be deleted on uninstall and upgrade)

<Custom Action=”REMOVEDIRS” Before=” InstallFinalize”>REMOVE=”ALL” AND NOT UPGRADINGPRODUCTCODE</Custom> – Correct (the product customization will be deleted on uninstall only. The user files and generated files will be available after upgrade).

Автоматическая генерация GUID

English: Wix Generate a GUID

В Wix есть возможность сказать компилятору, чтобы он автоматически генерил GUID для таких обьектов, как <Component>, <Package>, <Patch>,  <Product>. Я раньше думал, что для Component-а при каждой сборке будет генерится новый GUID.  Почитал на днях внимательно Wix help и обнаружил, что генерация ID Component-а базируется на значениях install directory и имени ключевого файла этой компоненты. Т.е. если эти параметры не меняются – ID будет сохраняться. Так что можно смело использовать <Component ID=”*”…./>.

Как получить значение свойства в Deferred Custom Action

English: How to Transfer Properties to Deferred Custom Action
Мы можем найти следующую информацию в MSDN. Где в последнем абзаце находим простое решение. Если его перевести на Wix-код, получим следующее (синим цветом выделено решение):

—–begin of test.wxs

<?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' >
 <Product Id='{00A86C83-0000-0000-0000-2FDF0595B100}'
  Name='Property to deffered custom action'
  Language='1033'
  Version='1.0.0.0' Manufacturer='Vlasenko'
  UpgradeCode='{00E9017B-0000-0000-0000-DDDF83756800}'>
  <Package Description="Property to a deffered custom action"
   Comments="http://vlasenko.org"
   InstallerVersion="300"
   Compressed="yes"/>
  <Media Id="1"
   Cabinet="_62E9A39FD9CC4E7436F7263EBE6CDCF4"
   EmbedCab="yes" />
  <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
  <Directory Id="TARGETDIR" Name="SourceDir">
   <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLDIR" Name="Property to deffered custom action">
     <Component Id="first" Guid="*">
      <File Id="test" DiskId="1"
       Name="test.wxs" Source="test.wxs" KeyPath="yes" />
     </Component>
    </Directory>
   </Directory>
  </Directory>
  <Feature Id='Main' Title='Property to deffered custom action' Level='1'>
   <ComponentRef Id="first" />
  </Feature>
    
  <CustomAction Id="ShowInstallDir.SetProperty"
   Property="ShowInstallDir" Value="[INSTALLDIR]" />
  <CustomAction Id="ShowInstallDir"
   Script="vbscript" Execute="deferred">
   <![CDATA[
   Dim property
   property = Session.Property("CustomActionData")
   MsgBox property
   ]]>
  </CustomAction>
  <InstallExecuteSequence>
   <Custom Action="ShowInstallDir.SetProperty"
    Before="InstallInitialize">NOT REMOVE="ALL"</Custom>
   <Custom Action="ShowInstallDir"
    Before="InstallFinalize">NOT REMOVE="ALL"</Custom>
  </InstallExecuteSequence>
   </Product>
</Wix>

end of test.wxs—–

To get msi-file:

  1. Download and install Wix.
  2. Save code to test.wxs
  3. Execute command candle test .wxs
  4. Execute command light -out test.msi test.wixobj

В следующий раз выложу код с реальным использованием этого решения (установка Apache httpd сервиса и генерация конфигурационного файла httpd.conf во-время инсталяции).