WixSharp.Msi.Core 2.1.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package WixSharp.Msi.Core --version 2.1.4                
NuGet\Install-Package WixSharp.Msi.Core -Version 2.1.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WixSharp.Msi.Core" Version="2.1.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WixSharp.Msi.Core --version 2.1.4                
#r "nuget: WixSharp.Msi.Core, 2.1.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WixSharp.Msi.Core as a Cake Addin
#addin nuget:?package=WixSharp.Msi.Core&version=2.1.4

// Install WixSharp.Msi.Core as a Cake Tool
#tool nuget:?package=WixSharp.Msi.Core&version=2.1.4                

stand with Ukraine

Build status NuGet version (WixSharp) Donate

paypal

<img align="right" src="https://github.com/oleg-shilo/wixsharp/blob/master/Documentation/wiki_images/wixsharp_logo.png" alt="" style="float:right">

Wix# (WixSharp) - managed interface for WiX

Framework for building a complete MSI or WiX source code by using script files written with the C# syntax.

This is a .NET Core release that is currently under reliability testing. For the product information please visit: https://github.com/oleg-shilo/wixsharp

How to use

Create project

Note, when .NET-Core packages are fully released they will come along with the Visual; Studio project templates as .NET-Framework packages do currently. But until it happens you will need to create your project manually or use this sample as a starting point.'

Steps:

  1. Create an ordinary Console Application project targeting .NET 8 and Windows: alt text

  2. Set post-build event command to:

    cd .\
    set ide=true
    dotnet "$(TargetPath)"
    

    alt text

  3. Add Nuget Package WixSharp.Core

Define setup build script

In your Program.cs file define:

using WixSharp;
using WixToolset.Dtf.WindowsInstaller;
using File = WixSharp.File;

Console.WriteLine(Environment.CurrentDirectory);

var project =
    new Project("My Product",
        new Dir(@"%ProgramFiles%\My Company\My Product",
            new File("program.cs")),
        new ManagedAction(Actions.CustomAction),
        new ManagedAction(Actions.CustomAction2),
        new Property("PropName", "<your value>")); ;

project.PreserveTempFiles = true;

project.UI = WUI.WixUI_ProgressOnly;

project.BuildMsi();

// -----------------------------------------------
public class Actions
{
    [CustomAction]
    public static ActionResult CustomAction(Session session)
    {
        Native.MessageBox("MSI Session\nINSTALLDIR: " + session.Property("INSTALLDIR"), "WixSharp - .NET8");

        return ActionResult.Success;
    }

    [CustomAction]
    public static ActionResult CustomAction2(Session session)
    {
        SetupEventArgs args = session.ToEventArgs();

        Native.MessageBox("WixSharp RuntimeData\nMsiFile: " + args.MsiFile, "WixSharp - .NET8");

        return ActionResult.UserExit; // terminate the setup
    }
}

When you build the project the MSI will be produced in your project root folder.

Note, because custom action are AOT compiled they have tendency to grow in size and add build time overhead try to avoid adding to much code that has other library dependencies unless you are OK with the impact.

Thus the custom action above uses Native.MessageBox which is nothing else but a Win32 MessageBox function. In the test environment the compile time is ~10 seconds. However replacing it with System.Windows.Forms.MessageBox adds quite a few aditional assemblies (e.g. WPF) and bumps compile time to a minute. This is a limitation of AOT compilation.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on WixSharp.Msi.Core:

Package Downloads
WixSharp.Core

.NET Core edition of WixSharp package

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.2 206 10/27/2024
2.4.1 176 10/5/2024
2.4.0 157 9/21/2024
2.3.2 277 8/10/2024
2.3.1 82 8/4/2024
2.3.0 172 7/13/2024
2.2.0 127 6/29/2024
2.1.7 266 5/27/2024
2.1.6 1,407 5/1/2024
2.1.5 2,474 4/6/2024
2.1.4 153 3/20/2024
2.1.3 884 3/6/2024
2.1.2 224 3/4/2024
2.1.1-pre 113 2/25/2024