Adding the WiX extension to our project
With a bit of help from our very smart and helpful friends at FireGiant, we know that the WiX extension we need is WixToolset.Util.wixext. Before we can run the code that tells us the actual type of processor we’re running on, we need to get WixToolset.Util.wixext into our project.
WiX extensions are NuGet packages
You might have heard somewhere that “WiX extensions are NuGet packages,” but that’s not exactly true. WiX extensions are just assemblies that you tell WiX to load when building your package. They contain code that tells WiX what functionality to expose and frequently contain an embedded library that lets them put things like custom action code into your package. However, those assemblies are — at least for WiX’s own extensions — bundled up as NuGet packages and are available on nuget.org for you to reference in your WiX project like any other NuGet packages from nuget.org that your projects might use.
You can see all the WiX extensions lovingly handcrafted by the WiX team here on nuget.org.
Adding a WiX extension to a WiX project
Because WiX’s extensions are shipped as NuGet packages on nuget.org, you add them to a WiX project the very same way you’d add them to a C# project:
- Right-click on
WixTutorialPackage. - Choose
Manage NuGet Packages. - Click
Browsein the upper left. (Some might wonder why Visual Studio doesn’t start there when the project has no NuGet packages installed.) (Others might wonder why the “tabs” look like plain ol’ text instead of more like buttons or, you know, tabs. Those people are frequently labeled UI curmudgeons.) - Enter
wixextin the search box. - Find
WixToolset.Util.wixextin the list.- If you can’t find
WixToolset.Util.wixextor get aNo packages foundmessage, make surenuget.orgorAllis selected in thePackage sourcedrop-down.
- If you can’t find
- Choose
WixToolset.Util.wixextin the list and clickInstallin the detail panel that magically appears on the right side of the NuGet Package Manager window. - You might get a
Preview Changesdialog that shows you’re installingWixToolset.Util.wixextin your project. (There’s aDon't show this againcheckbox so maybe you already prevented this annoying dialog from showing up.) If it appears, chooseApply.
Visual Studio churns a bit and when it’s done, you can see that the WixToolset.Util.wixext is installed by looking in the Dependencies node of Solution Explorer:
