Skip to content

A collection of tutorials for the Wix Toolset, which include a bunch of samples and examples

License

Notifications You must be signed in to change notification settings

n13org/WixToolset-Tutorials

Repository files navigation

WixToolset-Tutorials

A collection of tutorials for the Wix Toolset, which include a bunch of samples and examples.

Wix toolset (v3, v4 and v5) is the tool to create:

  • Modern MSI setups for the Windows Installer, main file is Product.wxs
  • Boostrapper EXE installer to handle prerequisites, main file is Bundle.wxs
  • Custom Actions to write your own C# code inside the Windows Installer, main file is CustomAction.cs

Slogan from the official Website:

THE MOST POWERFUL SET OF TOOLS AVAILABLE TO CREATE YOUR WINDOWS INSTALLATION EXPERIENCE.

A MSI can be inspected by the tool Orca from Microsoft (Orca - Documenation), which is part of the Windows Installer SDK and installed at C:\Program Files (x86)\Orca\Orca.exe. As an Alternative there is also SuperOrca which is NOT from Microsoft.

The Roadmap of the project.

When GPG signing is not working, try command gpgconf --launch gpg-agent

WixToolset v5

Visual Studio Extension

Install HeatWave for VS2022 by FireGiant to Visual Studio 2022. With this extension WixToolset v5 will be available and be supported.

Offical documentation for WixToolset v5

Docker - debian based

The docker usage is for the shell (bash) scripts to do download the HTML pages from Microsoft dotnet SDKs.

Major Max Version
5.0 5.0.17
6.0 6.0.31
7.0 7.0.20
8.0 8.0.6

These versions are stored (additionally) in _variables.sh.

Create the docker image

docker build --tag wixtoolset .

Run container interactive from docker image, use PWD as volume inside

docker run -it --rm -v ${pwd}:/ws/data wixtoolset /bin/bash

Inside the docker container

  1. Download the dotnet pages ./download-pages.sh, will be stored outside the container in the local download folder. This folder should be in gitignore and not under version controls.
  2. Parse the local HTML files to JSON with ./html2json.sh, the json files will be stored in a local datafolder. These json files can be under source control. For each SDK Runtime asp, desktop and runtime a file will be generated.
  3. Generate the WXS (wix toolset components) files with ./generateWixToolsetFragment.sh a local wix-dotnet folder will be generated.

An example wxs code, for dotnet v8.0.6 SDK Desktop runtime for x64, the original link would be .NET 8.0 Desktop Runtime (v8.0.6) Windows x64.

The code is copied from DotNet_DesktopRuntime_v8_0_6_x64.wxs below the folder wix-dotnet, where all other wxs-files are stored.

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx"
     xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">

    <Fragment>
    <netfx:DotNetCoreSearch
        RuntimeType="desktop"
        Platform="x64"
        MajorVersion="8"
        Variable="DOT_NET_VER" />

    <PackageGroup Id="DotNet_DesktopRuntime_v8_0_6_x64">
    <ExePackage Id="Netfx80"
                DisplayName="Microsoft .NET 8.0 Desktop Runtime"
                Description="Microsoft .NET 8.0 (8.0.6) Desktop Runtime for windows x64"
                PerMachine="yes" Permanent="yes" Vital="yes" InstallArguments="/norestart /quiet"
                DetectCondition="DOT_NET_VER &gt;= v8.0.6"
                bal:PrereqPackage="yes">
        <ExePackagePayload
            Name="runtime-desktop-8.0.6-windows-x64.exe"
            DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/76e5dbb2-6ae3-4629-9a84-527f8feb709c/09002599b32d5d01dc3aa5dcdffcc984/windowsdesktop-runtime-8.0.6-win-x64.exe"
            Hash="91bec94f32609fd194ac47a893cea1466e6ad25a16bbaf39cd6989fa9f09e865ba87669aabfe26cd3c8f2a57296170cc021dc762e238a6c5cb5e843d3df3169f"
            Size="58663408" />
        <ExitCode Value="0" Behavior="success" />
        <ExitCode Behavior="scheduleReboot" />
    </ExePackage>
    </PackageGroup>
    </Fragment>
</Wix>

Run the playwright tests inside the docker container. This command will execute all tests and will create a local folder playwright-report, which should be excluded from source control. Before the test can run, run ./joinjson.sh.

docker run -it --rm -v ${pwd}:/ws/data -v ${pwd}/playwright-report:/ws/playwright-report wixtoolset npx playwright test

History / Change Log

  1. Create the project on GitHub inside the "n13.org - Open-Source by KargWare"
  2. Change UI sequence UIRef from WixUI_Minimal to WixUI_Advanced
  3. Use Wix-Variables to avoid repeating your self many times, extract version to separate WXI file
  4. Add a customized dialog PrerequisitesDlg to the default WixUI_FeatureTree UI. It is also shared as a GitHub Gist. The branch features/AddPrerequisitesPage will stay.
  5. Add a wixtoolset bootstrapper project and add the MSI to it
  6. Move the folders to a file 'Directories.wxs', Folders and Directories in WixToolset
  7. Support WixToolset v5 driven by firegiant

Wix Toolset Extensions

Wix Toolset Extensions are stored inside C:\Program Files (x86)\WiX Toolset v3.11\bin (replace the version v3.11 with your version) as .dll and can be used as references inside your project.

Name Description
WixUIExtension UI Dialoges, UIRef, e.g. WixUI_Advanced, WixUI_FeatureTree and WixUI_Mondo

About

A collection of tutorials for the Wix Toolset, which include a bunch of samples and examples

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published