WiX: A Developer's Guide to Windows Installer XML

Book description

If you’re a developer needing to create installers for Microsoft Windows, then this book is essential. It’s a step-by-step tutorial that teaches you all you need to know about WiX: the professional way to produce a Windows installer package.

  • Package your software into a single-file, double-click MSI for easy installation
  • Read and write to the Windows Registry and create, start, and stop Windows Services during installation
  • Write .NET code that performs specific tasks during installation via custom actions
  • Learn how the WiX command-line tools work to build and link your project
  • Become proficient with to-the-point examples and real-world advice

In Detail

WiX is an open source project and a toolset that builds Windows installation packages from XML source code. WiX, which is used internally by Microsoft and by many companies around the World, simplifies many of the installation tasks that used to be shrouded in mystery. The tool set provides a command-line environment that you can integrate into your old-style build processes or you can use the newer technology from inside integrated development environments to build your setup packages. You'll find that you understand your installer better, can create it in less time, and save money in the process. No one really wants to devote a lifetime to understanding how to create a hassle-free installer for any software.

This hands-on guide takes the mystery out of Windows Installer by showing how simple XML elements can be leveraged to create a sophisticated install package. By relying on Microsoft standards, you'll be able to use features like Property elements to customize your application's entry in Add/Remove Programs, the Shortcut element to create Start menu shortcuts, and other specialized elements for building upgrade and patch support and more.

This book will show you the fundamental ingredients needed to build a professional-grade installer using Windows Installer XML. The initial chapters will introduce you to the set of required elements necessary to build a simple installer. We'll then explore those basic elements in more detail and see how best to use them in the real world.In the ensuing chapters, you'll move on to learn about adding conditions that alter what the user can install, then how to add actions to the install sequence and how to author a user interface. We'll move on to advanced topics such as editing data in the Windows Registry, installing a Windows service, and building your project from the command line. Finally, you'll learn to localize your package for different languages and detect older versions during upgrades. Each chapter uses to-the-point examples to illustrate the best way to use the language.

Create a hassle-free installer for your Windows software using WiX

Table of contents

  1. WiX: A Developer's Guide to Windows Installer XML
    1. WiX: A Developer's Guide to Windows Installer XML
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    6. 1. Getting Started
      1. Introducing Windows Installer XML
        1. What is WiX?
        2. Is WiX for you?
        3. Where can I get it?
        4. Votive
        5. A word about GUIDs
      2. Your first WiX project
        1. XML declaration and Wix element
        2. Product element
        3. Package element
        4. Media element
        5. Directories
        6. Components
        7. Files
        8. Features
        9. Start Menu shortcuts
        10. Putting it all together
      3. Adding a User Interface
      4. Viewing the MSI database
        1. Orca.exe
      5. Turning logging on during installation
      6. Other resources
      7. Summary
    7. 2. Creating Files and Directories
      1. File element
      2. DirectoryRef element
      3. ComponentGroup element
      4. Fragment element
      5. Harvesting files with heat.exe
      6. Copying and moving files
        1. Copying files you install
        2. Copying existing files
        3. Moving existing files
      7. Installing special-case files
        1. Adding assembly files to the GAC
        2. Installing a TrueType font
      8. Creating an empty folder
      9. Setting file permissions
      10. Speeding up file installations
      11. Summary
    8. 3. Putting Properties and AppSearch to Work
      1. Custom properties
        1. Declaring and setting properties
        2. Referencing properties
        3. Property visibility and scope
        4. Secure properties
        5. Property datatypes
      2. Predefined Windows Installer properties
        1. Implied properties
        2. Cited properties
      3. AppSearch
        1. DirectorySearch
        2. FileSearch
        3. ComponentSearch
        4. RegistrySearch
        5. IniFileSearch
      4. Summary
    9. 4. Improving Control with Launch Conditions and Installed States
      1. Conditions
        1. Condition syntax
        2. Launch conditions
        3. Feature conditions
        4. Component conditions
      2. Action state
      3. Installed state
      4. Summary
    10. 5. Understanding the Installation Sequence
      1. InstallUISequence
        1. UI standard actions
          1. AppSearch
          2. LaunchConditions
          3. ValidateProductID
          4. CostInitialize
          5. FileCost
          6. CostFinalize
          7. ExecuteAction
      2. InstallExecuteSequence
        1. Execute standard actions
          1. InstallValidate
          2. InstallInitialize
          3. ProcessComponents
          4. UnpublishFeatures
          5. RemoveRegistryValues
          6. RemoveShortcuts
          7. RemoveFiles
          8. InstallFiles
          9. CreateShortcuts
          10. WriteRegistryValues
          11. RegisterUser
          12. RegisterProduct
          13. PublishFeatures
          14. PublishProduct
          15. InstallFinalize
        2. Immediate vs. deferred
      3. Custom actions
        1. Set a Windows Installer Property
        2. Set the location of an Installed Directory
        3. Run embedded VBScript or JScript
        4. Call an external VBScript or JScript file
        5. Call a function from a dynamic-link library
        6. Trigger an executable
        7. Send an error that stops the installation
      4. Rollback custom actions
      5. Accessing properties in a deferred action
      6. Adding conditions to custom actions
      7. Deployment Tools Foundation
        1. Session object
        2. Getting and setting properties
        3. Logging
        4. Showing a MessageBox
        5. Accessing feature and component states
        6. Querying the MSI database
        7. Inserting rows into the MSI database
      8. Summary
    11. 6. Adding a User Interface
      1. WiX standard dialog sets
        1. WixUI_Advanced
        2. WixUI_FeatureTree
        3. WixUI_InstallDir
        4. WixUI_Mondo
        5. Customizing a standard dialog set
      2. Creating your own dialogs
        1. ICE20 errors
        2. Adding dialog files
        3. Scheduling dialogs
        4. Dialog element
        5. Adding TextStyle elements
        6. Adding a tabbable control
        7. Adding a progress dialog
      3. Modal windows
      4. ICE20 revisited
        1. FilesInUse
        2. Error
        3. FatalError
        4. UserExit
        5. Exit
      5. Summary
    12. 7. Using UI Controls
      1. Controls
        1. PushButton
        2. Text
        3. ScrollableText
        4. Line
        5. GroupBox
        6. Bitmap
        7. Icon
        8. Edit
        9. MaskedEdit
        10. PathEdit
        11. CheckBox
        12. RadioButtonGroup
        13. ComboBox
        14. ListBox
        15. ListView
        16. DirectoryList
        17. DirectoryCombo
        18. SelectionTree
        19. VolumeCostList
        20. VolumeSelectCombo
        21. Billboard
        22. ProgressBar
      2. Summary
    13. 8. Tapping into Control Events
      1. Publish element
      2. Subscribe element
      3. Publish events
        1. AddLocal
        2. DoAction
        3. EndDialog
        4. NewDialog
        5. Publishing a property
      4. Subscribe events
        1. ScriptInProgress
        2. SelectionAction
        3. TimeRemaining
      5. Summary
    14. 9. Working from the Command Line
      1. Candle.exe
        1. Command-line arguments (compiling)
          1. -arch
          2. -d
          3. -ext
          4. -fips
          5. -I
          6. -nologo
          7. -o
          8. -p
          9. -pedantic
          10. -sfdvital
          11. -ss
          12. -sw
          13. -trace
          14. -v
          15. -wx
        2. Response files
        3. .wixobj files
      2. Compile-time variables
        1. Environment variables
        2. System variables
        3. Custom variables
        4. Preprocessor extensions
      3. Conditional statements and iterations
        1. if...elseif...else
        2. ifdef
        3. ifndef
        4. Iterations
        5. Errors and warnings
      4. Light.exe
        1. Command-line arguments (linking)
          1. -ai
          2. -b
          3. -bf
          4. -binder
          5. -cultures
          6. -d
          7. -dut
          8. -ext
          9. -loc
          10. -nologo
          11. -notidy
          12. -o[ut]
          13. -pedantic
          14. -sadmin
          15. -sadv
          16. -sloc
          17. -sma
          18. -ss
          19. -sts
          20. -sui
          21. -sv
          22. -sw[N]
          23. -usf <output.xml>
          24. -v
          25. -wx[N]
          26. -xo
        2. Command-line arguments (binding)
          1. -bcgg
          2. -cc <path>
          3. -ct <N>
          4. -cub <file.cub>
          5. -dcl:level
          6. -eav
          7. -fv
          8. -ice<ICE>
          9. -pdbout <output.wixpdb>
          10. -reusecab
          11. -sa
          12. -sacl
          13. -sf
          14. -sh
          15. -sice:<ICE>
          16. -sl
          17. -spdb
          18. -sval
      5. Link-time variables
        1. Localization variables
        2. Binder variables
        3. Custom variables
      6. Building an installer without Visual Studio
      7. Summary
    15. 10. Accessing the Windows Registry
      1. Reading from the Registry
      2. Writing to the Registry
        1. RegistryValue
        2. RegistryKey
        3. Setting NeverOverwrite
      3. Removing Registry values
        1. RemoveRegistryKey
        2. RemoveRegistryValue
      4. Copying Registry values
      5. Registry permissions
      6. Summary
    16. 11. Controlling Windows Services
      1. Creating a simple Windows service
      2. Using sc.exe
      3. Using WiX to install a service
      4. Starting, stopping, and uninstalling a service
      5. Setting the service's user account
      6. Adding service dependencies
      7. Service recovery with Util:ServiceConfig
      8. Summary
    17. 12. Localizing Your Installer
      1. Setting language and code page attributes
        1. Package element
        2. Product element
      2. WiX localization files
      3. The role of Light.exe
      4. Localizing error messages
      5. Localizing the EULA
      6. Creating a multi-language MSI
      7. Summary
    18. 13. Upgrading and Patching
      1. Planning for updates
        1. Choosing an update type
        2. Per-user or per-machine
      2. Major upgrade
      3. Minor upgrade
        1. Authoring a patch file
        2. Building the patch on the command line
      4. Small update
      5. Summary

Product information

  • Title: WiX: A Developer's Guide to Windows Installer XML
  • Author(s): Nick Ramirez
  • Release date: October 2010
  • Publisher(s): Packt Publishing
  • ISBN: 9781849513722