You are previewing WiX Cookbook.
O'Reilly logo
WiX Cookbook

Book Description

Over 60 hands-on recipes packed with tips and tricks to boost your Windows installations

In Detail

WiX is a dialect of XML used to make installers for Windows. Its declarative style avoids the complexity and limitations of procedural code, providing you with everything you need to package up an entire application into a single MSI file.

This book gives you a good overview of WiX's capabilities to develop your own installer packages with functionalities beyond those available in Windows Installer. In the recipes of this book, you will see ways in which WiX can cut down on your installation time and help you streamline your deployment processes. You will see how to make customized installer UIs, write custom actions, create shortcuts, and also set your application as the default for a file type.

What You Will Learn

  • Install websites, application pools, and virtual directories in IIS

  • Add a wizard to your installer and customize it with your own dialogs

  • Set up new user accounts, add security groups, and secure files and folders on installation

  • Prevent deployment to unsupported systems by using launch conditions

  • Update XML files during installation

  • Configure shortcuts to your application

  • Include prerequisites with a bootstrapper

  • Create custom actions using C#

  • Add environment variables to the system

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. WiX Cookbook
      1. Table of Contents
      2. WiX Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. 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. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Organizing and Building WiX Projects
        1. Introduction
        2. Installing WiX and creating a new project in Visual Studio 2013
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        3. Referencing the output of a .NET console application in a WiX project by using a preprocessor variable
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Separating a portion of WIX markup into its own library
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Compiling a WiX installer on a build machine using MSBuild
          1. Getting ready
          2. How to do it…
          3. How it works…
        6. Building a WiX installer from the command line
          1. Getting ready
          2. How to do it…
          3. How it works…
      9. 2. Installing Files and Directories
        1. Introduction
        2. Installing directories onto the target computer
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Adding a file to a directory
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Installing a 64-bit executable file to Program Files
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Including one component or another depending on the condition
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        6. Using the heat.exe tool to generate components
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
      10. 3. File and Folder Permissions
        1. Introduction
        2. Changing the permissions on a folder for a user
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        3. Changing the permissions on a file for a user
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Marking a file as read only
          1. Getting ready
          2. How to do it…
          3. How it works…
        5. Creating a file share
          1. Getting ready
          2. How to do it…
          3. How it works…
        6. Setting the default program for a file type
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      11. 4. Shortcuts
        1. Introduction
        2. Adding an application shortcut to the Start menu
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Adding an icon to a shortcut
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Placing a shortcut on the desktop
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Creating a shortcut to a folder
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Creating an advertised shortcut that installs a feature on demand
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      12. 5. Editing XML Files during Installation
        1. Introduction
        2. Adding a new element to an XML file during installation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Setting the value of an attribute on an XML element
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Inserting inner text into an XML element
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Adding an XML element only if it does not already exist
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Removing an XML element
          1. Getting ready
          2. How to do it...
          3. How it works...
      13. 6. Custom Actions
        1. Introduction
        2. Creating a C# custom action and referencing it in your project
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Passing information entered by a user to a deferred custom action
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Preventing custom action data from being displayed in the install log
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Running an executable as a custom action without showing a console window by using CAQuietExec
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Testing rollback custom actions with WixFailWhenDeferred
          1. Getting ready
          2. How to do it...
          3. How it works...
      14. 7. Installing Wizards
        1. Introduction
        2. Adding a wizard to guide users through the installation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        3. Changing the logo images and default license agreement text of the wizard
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Customizing the wizard by adding a new dialog window to it
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Deciding which dialog to show next depending on the user's choices
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Setting a property based on user input
          1. Getting ready
          2. How to do it...
          3. How it works...
      15. 8. Users and Groups
        1. Introduction
        2. Creating a local user
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Adding a new user to a new group
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Adding a new user to an existing group
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Adding an existing user to a new group
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Adding a new user with the log on as a service security setting
          1. Getting ready
          2. How to do it...
          3. How it works...
      16. 9. Handling Prerequisites
        1. Introduction
        2. Stopping the installation with a launch condition
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Installing only to supported versions of Windows
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Redistributing the .NET Framework with a bootstrapper
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Executing either a 64-bit or 32-bit MSI depending on the user's operating system
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Downloading resources from the Web with a web installer
          1. Getting ready
          2. How to do it...
          3. How it works...
      17. 10. Installing Websites
        1. Introduction
        2. Spinning up a new application pool in IIS
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Adding a website to IIS that runs under your app pool
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Creating a virtual directory
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Adding a web application to IIS
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Setting up a website to use SSL
          1. Getting ready
          2. How to do it...
          3. How it works...
      18. 11. Linking to the Web
        1. Introduction
        2. Adding a hyperlink control to a wizard dialog
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Opening an installed HTML file after a successful installation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Launching a web page when a user uninstalls our software
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Installing a shortcut that opens a web page
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Updating programs and features to show a link to our company's website
          1. Getting ready
          2. How to do it...
          3. How it works...
      19. 12. Installing SQL Server Databases
        1. Introduction
        2. Installing a SQL Server instance with a bootstrapper
          1. How to do it...
          2. How it works...
        3. Adding a database to a SQL Server instance
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Creating a table within a SQL Server database
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Inserting data into a database table
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Creating an ODBC data source for a SQL Server instance
          1. Getting ready
          2. How to do it...
          3. How it works...
      20. 13. Admin Tasks
        1. Introduction
        2. Setting an environment variable
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Creating a scheduled task
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Defining a new event source for the Windows event viewer
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Registering a performance counter
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Adding an exception to Windows Firewall
          1. Getting ready
          2. How to do it...
          3. How it works...
      21. Index