Bob's Favorite Things: WiX v4 Preview 1 Edition
WiX v4-preview.1 has been released. You can read my artisanal release notes here.
There are a lot of new things in WiX v4, a lot of which are hidden inside the guts of the compiler, linker, and backends. Here are my favorite user-visible features:
WiX has supported all the platforms Windows Installer supports, including Itanium back in the day and 32-bit Arm back when only Microsoft-blessed companies could ship native Arm binaries. In WiX v3.14, we added support for Arm64 in the core toolset and some of the extensions. In WiX v4, we went all out on Arm64:
- Core toolset (of course)
- All extensions
Also noteworthy is that all of the custom actions in all the extensions are platform-specific. In WiX v3, we used x86 custom actions except where we couldn’t. (WixUtilExtension, for example, used x86 for everything, with tweaks like disabling file system redirection, except for the “SecureObjects” custom actions.) In WiX v4, all the custom actions are compiled for x86, x64, and Arm64. So now if you compile a package for x64, you get x64 custom actions and your MSI package will run on, for example, a Windows Server where WoW64 was removed.
The same is true of Burn: In WiX v3, there was only one Burn engine (x86, to rule them all) and it was used even if you built the bundle as x64. (There was a 32-bit Arm Burn engine, but as only Microsoft had the magic key to enable native Arm binaries, it doesn’t really count.) An x86 bundle is as close as you can come to a “universal” bundle: Thanks to WoW64 and emulation, an x86 bundle runs on almost every system out there and Burn makes it easy to choose platform-specific packages where they’re needed.
But if you want a platform-specific bundle, Burn’s there for you, 32-bit and 64-bit alike.
“Modern acquisition experience”
Back in The Long Ago Time(tm), you checked your tools and libraries into source control, so they’d be versioned, every developer could easily get them, and of course your build lab didn’t have Internet connectivity. Back when WiX v2 was first released as open source – 18 1/2 years ago, which I believe qualifies it as Long Ago Time – it was shipped as a .zip file, because of course you’d just unzip it into your source tree. There were plenty of snarky comments that WiX, of all things, didn’t have an installer.
That was then. Now it’s expected that the first step in every build is to restore (read: download) tools and libraries. For the .NET and Visual Studio world, those tools and libraries are delivered as NuGet packages, usually from NuGet.org itself.
WiX v3 didn’t have “official” NuGet support, though there were unofficial NuGet packages. Those worked using the packages.config (“old”) style of NuGet, which on restore downloads packages into a relative
packages directory and the .wixproj imports .targets and .props file from that tree.
The new style of NuGet has two flavors:
- SDK-style projects where the “SDK” is a set of tools, .targets, and .props files that are restored from NuGet
PackageReferenceelements that trigger those packages to be restored and referenced
WiX v4 supports both flavors:
WixToolset.Sdkis the WiX v4 core toolset in a NuGet package, wired up as an MSBuild SDK.
- WiX extensions like
WixToolset.Util.wixextare shipped as NuGet packages and can be referenced in .wixproj using
For example, here’s a fully functional minimum .wixproj using the
WixToolset.Sdk MSBuild SDK:
<Project Sdk="WixToolset.Sdk/4.0.0-preview.1"> </Project>
Here’s one using the
WixToolset.Util.wixext WiX extension:
<Project Sdk="WixToolset.Sdk/4.0.0-preview.1"> <ItemGroup> <PackageReference Include="WixToolset.Util.wixext" Version="4.0.0-preview.1" /> </ItemGroup> </Project>
Even though I trend toward the old school configuration management model of handling your dependencies, even I have to admit being able to let MSBuild and NuGet handle bootstrapping WiX and WiX extensions is a huge win for usability. No install needed and upgrades are as simple as changing a line in a .wixproj. (Actually, it’s even easier than that: You can use global.json to control versioning for an entire project/solution.)
Just the beginning…of the end
As I reported from our last WiX Online Meeting, the next preview release of WiX v4 will be RC1 and is scheduled for 16-December, just over a month from now. So now’s the time to download HeatWave and convert your WiX v3 projects to WiX v4 and let us know how it goes.