# Wix Task

## Wix

### Description

Runs the candle, light or both from the Wix toolset.

### Parameters

Attribute | Description | Required
source | The single source file to process. | Either this or at least one nested <sources> set.
target | The expected target file. | Yes, unless you run candle without light.
mode | Which part of the toolset to run, one of "candle", "light" or "both". | No, default is "both".
vm | Same as dotnetexec's vm attribute. Specify the framework to use. | No.

### Parameters specified as nested elements

#### sources

Specify source files that shall be passed on the command line. This is a fileset.

#### moresources

Specify source files that shall not be passed on the command line. This is a fileset.

Typically this would list include files when running candle or the files that vecome part of the MSI file when running light. The files in this set are only used for timestamp comparisons. If neither these files nor the given "normal" sources are newer than the expected target, the task won't do anything.

### Examples

Create `product.wixobj` from `product.wxs`:

          <wix mode="candle" source="product.wxs"/>

The same but using a nested sources element:

          <wix mode="candle">
            <sources dir=".">
              <include name="product.wxs"/>
            </sources>
          </wix>

Create `product.msi` from `product.wixobj`:

          <wix mode="light" source="product.wixobj" target="product.msi"/>

Combine the examples into a single step:

          <wix source="product.wxs" target="product.msi"/>

Note that the task wouldn't do anything if `product.wxs` was older than `product.wixobj` and `product.wixobj` was older than `product.msi`.

Compile multiple `.wxs` files at once:

          <wix mode="candle">
            <sources dir=".">
              <include name="*.wxs"/>
            </sources>
          </wix>

Compile multiple `.wxs` files at once, specify some include files in addition to that:

          <wix mode="candle">
            <sources dir=".">
              <include name="*.wxs"/>
            </sources>
            <moresources dir=".">
              <include name="*.wxi"/>
            </moresources>
          </wix>

Link multiple `.wixobj` files at once:

          <wix mode="light" target="product.msi">
            <sources dir=".">
              <include name="*.wixobj"/>
            </sources>
          </wix>

Link multiple `.wixobj` files at once and specify that the files in directory "source" will become part of the package:

          <wix mode="light" target="product.msi">
            <sources dir=".">
              <include name="*.wixobj"/>
            </sources>
            <moresources dir="source"/>
          </wix>

    Combine multiple .wxs files and include files
        into a single package and specify that the package will contain
        files from the source directory:

          <wix target="product.msi">
            <sources dir=".">
              <include name="*.wxs"/>
            </sources>
            <moresources dir=".">
              <include name="*.wxi"/>
            </moresources>
            <moresources dir="source"/>
          </wix>

Again, if the intermediate `.wixobj` files are newer that the corresponding `.wxs` files (and all include files) the candle step will be skipped. If `product.msi` is newer than all files, the task won't do anything.

Copyright © 2004 The Apache Software Foundation. All rights Reserved.