Repository navigation
Support for MSIX
Currently, there is no dedicated support for building MSIX. Though WixSharp is flexible enough to allow building MSIX with a very simple extension of the stock API.
There are two scenarios of how you can build MSIX with WixSharp:
Dependency: MsixPackagingTool and MSIX drive
Documentation: https://learn.microsoft.com/en-us/windows/msix/packaging-tool/create-app-package
You can find a working sample here.
This is how you can build MSIX in this sample:
var msi = project.BuildMsi();
project.UpdateTemplate(@".\MyProduct.msix.xml", msi);
if (WindowsIdentity.GetCurrent().IsAdmin())
{
msi.ConvertToMsix(@".\MyProduct.msix.xml");
}
else
{
Console.WriteLine("Error: you need run the build process as Administrator.");
}Note WixSharp still does not offer a true API for building MSI. Instead, it shows with the code sample how to use WixSharp MSI features to build an MSI and then convert it to the MSIX with the MsixPackagingTool.
WixSharp does the heavy lifting by updating the MSIX template with the product information available from the msi file. WixSharp also takes care of invoking MSIX compiler with the required CLI parameters.
Documentation: https://www.firegiant.com/docs/fg-wix/msix/integrating-the-firegiant-msix-extension/
This is an example of adding a FireGiant.HeatWave.BuildTools.Msix.wixext WiX elements and engaging WiX tools for building MSIX:
public class Program
{
static void Main()
{
var project = new Project("MyProduct",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File("Program.cs",
new MsixApplication
{
Id = "MyProductApp",
OverrideDisplayName = "My Desktop Product"
})));
project.GUID = new Guid("72a3b240-c984-4ef8-91e2-2b0319cd0aec");
project.BuildMsix();
}
}
public class MsixApplication : WixEntity, IGenericEntity
{
[Xml]
public new string Id { get => base.Id; set => base.Id = value; }
[Xml]
public string OverrideDisplayName;
public void Process(ProcessingContext context)
{
var extension = new WixExtension(
"FireGiant.HeatWave.BuildTools.Msix.wixext", "msix",
"http://www.firegiant.com/schemas/v4/wxs/heatwave/buildtools/msix");
context.Project.Include(extension);
context.XParent.Add(this.ToXElement(extension, "Application"));
}
}
static class WixSharpExtensions
{
public static void BuildMsix(this Project project)
{
project.WixBuildCommandGenerated += (cmd) => " -outputType msix " + cmd;
project.BuildMsi();
}
}However, you will need a properly licenced (quite expensive) account from FireGiant (see this info).
There was some talk about this that you may find useful: https://github.com/oleg-shilo/wixsharp/issues/1708.
Be aware that FireGiant MSIX extension is still raw as of Jan-2025. Thus the only sample found at that time contains invalid attribute msix:Application.OverrideDisplayName and there was no documentation on the XML schema to verify or address that.
- Home - Overview
- Architecture
- Documentation
- Samples Library
- Product Roadmap
- Tips'n'Tricks
- Code Contributions Guideline