WiX Tip: Automate publishing using MSBuild and Windows Installer XML

Source: Internet
Author: User
Tags visual studio

This article discusses:

Windows Installer XML Overview

Create WiX Packaging instructions

Integrated WiX and MSBuild

Automate build and package

This article uses the following techniques: Visual Studio, Windows Installer XML (WiX), MSBuild

Directory

WiX Introduction

Creating WiX files WiX and msbuildmsbuild batch processing automate build and package analysis MSBuild scripting Overview Customizing Process Summary

In the development process, it is important to have an automatic generation process. It is also important to have the means of automatically creating a publication. Unfortunately, in many organizations (especially smaller organizations), there is no such. Typically, you will find that the publication is only pieced together at the last minute. However, if you take the time to set up an automated build and publish plan, you save countless hours, and you can better use those times to accomplish tasks rather than build and publish projects.

In this article, I'll describe how to implement an automated and repeatable build and publish process in your organization using the Microsoft®build Engine (MSBuild) and Windows®installer XML (WiX) toolset. This article discusses WiX v2 (note that some syntax samples are not directly converted when WiX V3 is published). Although WiX does simplify the process of creating a publication, whether or not you use WiX to create a publication, the techniques described in this article are available for your reference. You can also make some modifications to these technologies and apply them to applications that are not developed using Microsoft. NET Framework 2.0 (This article also contains links to English web pages).

I will assume that you are familiar with MSBuild (if you need to get a new look at it, see my article in the June 2006 Msdn® magazine for an in-depth look at MSBuild: a custom task that compiles an application in its own way through a Microsoft build Engine). I will provide an overview of the WiX toolset for those who are unfamiliar with the tool. See the sidebar "MSBuild and WiX resources" for references to more relevant articles and tools. For the purposes of this article, I will use my Sedodream MSBuild project. You can get the latest source code from Www.codeplex.com/Sedodream.

WiX Introduction

When you create an application, the final result is to install and run it on the production computer. The WiX toolset can help you accomplish this task. In this section, I'll describe WiX and explain how to use WiX to create an installer.

WiX describes what the installation looks like on the target computer. From Visual studio® to Microsoft Office, Windows Installer is used in many Microsoft applications. You may be surprised to find that WiX is actually an open source project and is hosted on SourceForge.net. You can download the latest binaries and source files from Wix.sourceforge.net. After you download and install WiX, you will find that a large number of executables are installed on your computer, as summarized in Figure 1. I will focus on the use of Candle.exe and Light.exe tools.

Figure1wix components

/tr>
name description
candle.exe
dark.exe > turn MSI file Swap to the appropriate WiX source file (which can be considered a "decompile" installer).
light.exe from WiX source text The middle representation of a piece generates Windows Installer.
lit.exe
tallow.exe for creating the Wi X source XML to copy the files and folders it has in the installation directory or file.
wixcop.exe check WiX There is a dive in the source fileIn the area of the problem, similar to FxCop.

WiX uses declarative language rather than procedural language, which means you want to describe what your installation will look like without describing the steps you need to take to implement it. This may be different from your habits, but it's very easy to master. Typically, a description file to be installed on the target computer populates the WiX source file. Here, I will focus on these components.

In the WiX source file, there are three key elements associated with the files you want to install: files, components, and features. A file element is a reference to a single file. The file must be included in the component element, and the component element is the smallest installation unit. That is, if you have a component that contains 100 files, and you want to install the component, all of the files it contains are installed. Conversely, if you do not install the component, no files are installed. It is not recommended to create a component that contains a large number of files.

Components are always included in the feature element and can be included in multiple functions. A feature is a set of components, or it may be a set of child functions. If the installer has a graphical interface that allows users to choose which items to install, the user is actually selecting the feature.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.