ff8mania
ff8mania

Reputation: 1770

Wix4: Getting started impossible and examples wrong

For some projects I'm working on, I'd like to move my deployments from ps1 scripts to an msi (built at the end of a pipeline). I decided then to follow the "Wix way" and also take the opportunity to learn it. I went to the official website, and decided to use the latest version (the 3.x is more commonly used, but since 4 it is just been released, I thought it was better to start from there).

I looked online for some getting started to learn the basics, and it looks like nothing exists. Then I tried to follow the official guide to at least have the classic "hello world" MSI, using this example (took from here):

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

<Bundle
    Name="FirstSample"
    Version="0.0.1.1"
    UpgradeCode="fc56ffde-f642-4086-b22a-306ba0732b12"
    Compressed="no"
    SplashScreenSourceFile="splashscreen.bmp">

    <BootstrapperApplication>
        <bal:WixStandardBootstrapperApplication
            LicenseUrl=""
            Theme="hyperlinkLicense" />
    </BootstrapperApplication>

    <Chain>
        <PackageGroupRef Id="BundlePackages" />
    </Chain>
</Bundle>

The moment I try to build it, with

wix build .\SampleFirst.wxs

The result is:

error WIX0200: The BootstrapperApplication element contains an unhandled extension element 'WixStandardBootstrapperApplication'. Please ensure that the extension for elements in the 'http://wixtoolset.org/schemas/v4/wxs/bal' namespace has been provided.

I have two questions:

  1. Do you think this is the right approach to learning Wix?
  2. If yes, what was wrong with the sample wsx I got from the official website?

Thanks

Upvotes: 6

Views: 4159

Answers (2)

Rob Mensching
Rob Mensching

Reputation: 36026

  1. Do you think this is the right approach to learning Wix?

I wouldn't recommend it. I get the desire to start at the lowest level (just the command-line) to "keep it simple", but that also means you get the least amount of help. If you understand the Windows Installer technology, this lowest level gives you extreme amounts of control. If you're not familiar with the Windows Installer then you are jumping in the deep end alone.

  1. If yes, what was wrong with the sample wsx I got from the official website?

The problem is that you used the file extension .wsx. It's a common mistake, but the standard WiX source code file extension is actually .wxs.

Just kidding. The file extension doesn't have to match but a lot of the automatic detection of files in the build systems works when you use the correct file extension.

The real issue is that you are starting with a Bundle. Bundles are collections of packages. The packages do the actual installation operations like copying files and writing registry keys. Therefore, Bundles are not where you start.

You want to start with a Package element.

My company is in the process of rewriting the WiX Tutorial for WiX v4. It's a large task. In the meantime, you might find my weekly YouTube show called Deployment Dojo helpful.

At the time of writing this answer, WiX v4 leans very heavily on WiX v3 knowledge. Updating the documentation to directly teach WiX v4 concepts is high on my list.

Upvotes: 4

Tarazed
Tarazed

Reputation: 2675

WiX 4 delivers extensions through NuGet packages. This can be achieved in one of two ways.

If building an MSBuild (*.wixproj) file, you can add the extension as you would add any NuGet package in a .Net "SDK" project file.

<ItemGroup>
  <PackageReference Include="WixToolset.Bal.wixext" Version="4.0.1" />
</ItemGroup>

However, when using the command line interface, you will need to manage your extension cache. From the terminal in the project path, run the following:

wix extension add WixToolset.Bal.wixext

You can confirm this has been obtained by running:

wix extension list

This extension cache folder is named ".wix". If you would prefer to do this globally rather than a relative path, add the -g (or --global) switch:

wix extension add -g WixToolset.Bal.wixext

Once you have it cached, include it in your build

wix build -ext WixToolset.Bal.wixext .\SampleFirst.wxs

Upvotes: 1

Related Questions