WixSharp.Core
2.4.3
dotnet add package WixSharp.Core --version 2.4.3
NuGet\Install-Package WixSharp.Core -Version 2.4.3
<PackageReference Include="WixSharp.Core" Version="2.4.3" />
paket add WixSharp.Core --version 2.4.3
#r "nuget: WixSharp.Core, 2.4.3"
// Install WixSharp.Core as a Cake Addin #addin nuget:?package=WixSharp.Core&version=2.4.3 // Install WixSharp.Core as a Cake Tool #tool nuget:?package=WixSharp.Core&version=2.4.3
<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:
Create an ordinary Console Application project targeting .NET 8 and Windows:
Set post-build event command to:
cd .\ set ide=true dotnet "$(TargetPath)"
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows7.0 is compatible. |
-
net8.0-windows7.0
- WixSharp.Msi.Core (>= 2.4.3)
- WixToolset.Dtf.WindowsInstaller (>= 4.0.4)
- WixToolset.Mba.Core (>= 4.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on WixSharp.Core:
Repository | Stars |
---|---|
oleg-shilo/wixsharp
Framework for building a complete MSI or WiX source code by using script files written with C# syntax.
|
Version | Downloads | Last updated |
---|---|---|
2.4.3 | 380 | 12/3/2024 |
2.4.2.1 | 81 | 11/28/2024 |
2.4.2 | 320 | 10/27/2024 |
2.4.1 | 213 | 10/5/2024 |
2.4.0 | 235 | 9/21/2024 |
2.3.2 | 327 | 8/10/2024 |
2.3.1 | 107 | 8/4/2024 |
2.3.0 | 195 | 7/13/2024 |
2.2.0 | 149 | 6/29/2024 |
2.1.7 | 443 | 5/27/2024 |
2.1.6 | 1,555 | 5/1/2024 |
2.1.5 | 2,462 | 4/6/2024 |
2.1.4 | 163 | 3/20/2024 |
2.1.4-hotfix | 107 | 3/19/2024 |
2.1.3 | 1,282 | 3/6/2024 |
2.1.2 | 272 | 3/4/2024 |
2.1.1-pre | 98 | 2/25/2024 |