WixSharp.Msi.Core
2.1.2
See the version list below for details.
dotnet add package WixSharp.Msi.Core --version 2.1.2
NuGet\Install-Package WixSharp.Msi.Core -Version 2.1.2
<PackageReference Include="WixSharp.Msi.Core" Version="2.1.2" />
paket add WixSharp.Msi.Core --version 2.1.2
#r "nuget: WixSharp.Msi.Core, 2.1.2"
// Install WixSharp.Msi.Core as a Cake Addin #addin nuget:?package=WixSharp.Msi.Core&version=2.1.2 // Install WixSharp.Msi.Core as a Cake Tool #tool nuget:?package=WixSharp.Msi.Core&version=2.1.2
<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
- 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 | 195 | 10/27/2024 |
2.4.1 | 172 | 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 | 167 | 7/13/2024 |
2.2.0 | 127 | 6/29/2024 |
2.1.7 | 264 | 5/27/2024 |
2.1.6 | 1,392 | 5/1/2024 |
2.1.5 | 2,474 | 4/6/2024 |
2.1.4 | 153 | 3/20/2024 |
2.1.3 | 873 | 3/6/2024 |
2.1.2 | 219 | 3/4/2024 |
2.1.1-pre | 113 | 2/25/2024 |