This is a simple sample for a Windows Installer XML project using minimal authoring to create a Windows Installer package (.msi file).
It contains:
- SampleApp - a simple console application.
- SampleProduct - a WiX project that references the SampleApp project and its target output.
After installing the prerequisites in the Building section below:
- Create a new .NET Core console application (keep project in a separate directory from the solution).
- Find and create a "Setup Project for WiX v3".
- Right-click on the setup project and click Add -> Reference...
- Edit Product.wxs to change the
ProductName
andManufacturer
attributes on the rootProduct
element. - Edit the
ProductComponents
component group to reference your product file:You do not need to specify any other attributes.<Component> <File Source="$(var.SampleApp.TargetPath)" /> </Component>
- You can optionally author registry values in another component (generally recommended to keep resources separate):
In this case, we specify the
<Component> <RegistryKey Root="HKLM" Key="Software\[Manufacturer]\[ProductName]"> <RegistryValue Name="InstallDir" Type="string" Value="[INSTALLFOLDER]" /> <RegistryValue Name="Version" Type="string" Value="[ProductVersion]" KeyPath="yes" /> </RegistryKey> </Component>
KeyPath
attribute on a registry value that will change with each update. When multiple resources are contained within a component, you often need to denote which one is the primary one that will help identify when a component has been upgraded.
If you have a lot of projects or project outputs, you can attempt to harvest those projects. This option will harvest directories and files output by the projects based on which output groups you select (default: Binaries, Content, and Satellite assemblies). It will also harvest any subdirectories. Please be aware that harvesting a project may not always yield the exact results you want, but may be useful for simple projects, or in early product development releases.
To build this solution, you'll need:
- Microsoft Visual Studio
- Windows Installer XML 3.0
- WiX Toolset Extension appropriate for your Visual Studio version.
Open the solution and build.
This project is licensed under the MIT license. See LICENSE.txt for details.