Crate wix

source ·
Expand description

wix Library

The goal of the cargo-wix project and the wix library is to make it easy to create a Windows installer (msi) for any Rust project. The cargo-wix project is primarily implemented as a cargo subcommand, but its core functionality has been organized into a separate library. Documentation for the binary and Command Line Interface (CLI) are provided in the module-level documentation for the binary and the cargo wix --help command.

Table of Contents

Usage

First, add this to your Cargo.toml:

[dependencies]
wix = "0.1"

Next, if not using Rust 2018 edition, then add this to the lib.rs or main.rs file for your project:

extern crate wix;

Organization

Each subcommand is organized into a separate module. So, there is a create, initialize, print, etc. module within the crate. Some of the modules are in a single Rust source file, while others are organized into sub-folders. Each module follows the Builder design pattern, so there is a Builder and Execution struct for each module/subcommand. The Builder struct is used to customize the execution of the subcommand and builds an Execution struct. The Execution struct is responsible for actually executing the subcommand, which generally involves executing a process with the std::process::Command struct, but not always. Each method for the Builder struct generally corresponds to a CLI option or argument found in the cargo wix subcommand and binary.

Modules

  • The implementation for the clean command. This command is focused on cleaning up build output, similar to the cargo clean subcommand.
  • The implementation for the create, or default, command. The default command, cargo wix, is focused on creating, or building, the installer using the WiX Toolset.
  • The implementation for the init command. The init command for the cargo wix subcommand is focused on creating a WiX Source file (wxs) based on the contents of the Cargo manifest file (Cargo.toml) for the project and any run-time based settings.
  • The implementation for the print command. This command is focused on printing various templates based on a package’s manifest (Cargo.toml) or end-user input.
  • The implementation for the purge command. This command is focused on removing all files associated with cargo wix subcommand.
  • The implementation for the sign command. This command focuses on signing installers using the Windows SDK signtool application.
  • Utilities for working with paths that need to be stored in files in a cross-platform way.

Enums

  • The various culture codes for localization.
  • The error type for wix-related operations and associated traits.
  • The different templates that can be printed or written to a file.
  • The aliases for the URLs to different Microsoft Authenticode timestamp servers.
  • The different architectures supported by the WiX Toolset.

Constants

  • The name of the folder where binaries are typically stored.
  • The name of the builder application for a Rust project.
  • The file name with extension for a package’s manifest.
  • The file extension for an executable.
  • The file name without an extension when generating a license.
  • The application name without the file extension of the msiexec utility.
  • The file extension for a Windows installer.
  • The file extension for a Rich Text Format (RTF) file.
  • The name of the signer application from the Windows SDK.
  • The name of the environment variable to specify the path to the signer application.
  • The default name of the folder for output from this subcommand.
  • The application name without the file extension of the compiler for the Windows installer.
  • The application name without the file extension of the linker for the Windows installer.
  • The file extension for a WiX Toolset object file, which is the output from the WiX compiler.
  • The name of the environment variable created by the WiX Toolset installer that points to the bin folder for the WiX Toolet’s compiler (candle.exe) and linker (light.exe).
  • The file extension of the WiX Source file, which is the input to the WiX Toolset compiler.
  • The default file name for the WiX Source file, which is the input to the WiX Toolset compiler.

Type Definitions