Net4x.InstallerLibrary
1.8.1.26250
dotnet add package Net4x.InstallerLibrary --version 1.8.1.26250
NuGet\Install-Package Net4x.InstallerLibrary -Version 1.8.1.26250
<PackageReference Include="Net4x.InstallerLibrary" Version="1.8.1.26250" />
<PackageVersion Include="Net4x.InstallerLibrary" Version="1.8.1.26250" />
<PackageReference Include="Net4x.InstallerLibrary" />
paket add Net4x.InstallerLibrary --version 1.8.1.26250
#r "nuget: Net4x.InstallerLibrary, 1.8.1.26250"
#:package Net4x.InstallerLibrary@1.8.1.26250
#addin nuget:?package=Net4x.InstallerLibrary&version=1.8.1.26250
#tool nuget:?package=Net4x.InstallerLibrary&version=1.8.1.26250
Net4x.InstallerLibrary
Generates a WiX Toolset v3 setup project for the projects of a Visual Studio
solution, and adds the generated projects back into the .sln.
You point it at a solution and say which of its projects should get an installer. For each one it writes a
*_Setup folder next to the solution — a .wixproj plus the .wxs / .wxi / .rtf files WiX needs — and
returns the solution with the new project, its dependency on the project it installs, and its build
configurations already in place. The setup project harvests the project's build output with HeatDirectory,
so the file list never has to be maintained by hand.
Net4x.InstallerTool is the same thing as a command line executable and an MSBuild target; use this package
when you want to drive the generation from your own code.
Installing
dotnet add package Net4x.InstallerLibrary
Targets net40, net45 and netstandard2.0. Generating an installer needs the WiX Toolset v3.11 (or newer)
only when the generated project is built; generating it does not.
Adding installers to a solution
using ConfigurationLibrary.Arguments;
using ConfigurationLibrary.Configuration;
using ConfigurationLibrary.Configuration.Json;
using InstallerLibrary;
using InstallerLibrary.Installers;
AppConfigFactory.Instance.AppConfigBaseType = typeof(IJsonConfig);
ConfigurationVariables.Instance.Configuration = "Release";
ConfigurationVariables.Instance.Platform = "x64";
ConfigurationVariables.Instance.ProjectsToCreateInstall = new[] { "MyApp.csproj" };
var solution = InstallerHelper.Instance.AddInstallersToSolution(@"D:\src\MyApp\MyApp.sln");
solution?.SaveAs(@"D:\src\MyApp\MyApp.sln");
AddInstallersToSolution returns null when no project was asked for, and otherwise a Solution you can
inspect or save. It is safe to run again: a setup project already referenced by the solution is left alone.
Rather than setting ProjectsToCreateInstall in code, you can put a .json file beside the solution and
name it after it — MyApp.sln is paired with MyApp.json:
{ "appSettings": { "ProjectsToCreateInstall": "MyApp.csproj" } }
Several projects are separated by the argument separator (| by default), and a project may name the target
framework it should be built for after a comma: "MyApp.csproj,net48|MyService.csproj".
To decide the list at run time — by asking the user, for instance — handle EnrichProjectsToCreateInstall,
which is raised with whatever configuration supplied and whose Value you may replace:
InstallerHelper.Instance.EnrichProjectsToCreateInstall += (sender, e) =>
{
if (e.Value.Length == 0)
{
e.Value = new[] { "MyApp.csproj" };
}
};
What is generated
For a project MyApp.csproj the library writes, beside the solution, a directory named after the project and
the target framework — MyApp.net48_Setup — containing:
| File | Purpose |
|---|---|
MyApp.net48_Setup.wixproj |
The WiX project. Harvests the build output into INSTALLDIR and references MyApp.csproj. |
Product.wxs |
The product, its feature and its install directory. |
Defines.wxi |
Product name, manufacturer, version and upgrade code. The upgrade code is derived from the product name, so it stays the same across runs. |
Shortcuts.wxi |
The start menu shortcut to the built executable. |
License.rtf |
The licence shown by the installer UI. |
Product.wxs, the .wixproj and License.rtf are written only if they are not already there, so edits to
them survive a regeneration; Defines.wxi and Shortcuts.wxi are rewritten from the project every time.
The installed project also gains a <GeneratedInstaller>true</GeneratedInstaller> property, which marks it as
already handled.
The templates come from a Resources directory next to the running assembly. Point
ConfigurationVariables.Instance.ResourcesDirectory elsewhere to use your own.
Configuration
Everything is read through ConfigurationLibrary's ArgumentGetter, so each of these can come from the
command line, the application configuration, an environment variable, or the solution's .json.
ConfigurationVariables.Instance is the typed view of them.
| Key | Meaning |
|---|---|
ProjectsToCreateInstall |
The projects to create installers for. |
Configuration |
The build configuration whose output is installed. Defaults to Release. |
Platform |
The platform written into the solution and the WiX package. Defaults to x86. |
TargetFramework |
The target framework whose output is installed, for multi-targeted projects. |
ResourcesDirectory |
Where the templates are read from. Defaults to Resources beside the assembly. |
WinUIExtension |
Path of WixUIExtension.dll. Defaults to the WiX Toolset v3.11 installation. |
DirectoriesToExclude |
Directory names to leave out of the harvested tree. |
Reading and editing a solution
The .sln parser is usable on its own:
using InstallerLibrary;
using InstallerLibrary.Solutions;
var solution = Solution.Parse(@"D:\src\MyApp\MyApp.sln");
foreach (var project in solution.Projects)
{
Console.WriteLine($"{project.ProjectName}: {project.RelativePath}");
}
var found = solution.FindProject("MyApp.csproj");
solution.SaveAs(@"D:\src\MyApp\MyApp.Copy.sln");
Solution.Projects lists the buildable projects; GetProjects(true) includes the solution folders.
Lines is the whole file, with every Project(...) entry parsed into a SolutionProject, so a solution can
be rewritten line by line and saved back.
Copyright: Copyright (c) Piero Viano. All rights reserved. Authors: Piero Viano Company: Piero Viano
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- Net4x.InputBoxLibrary.WinForms (>= 2.0.0.26250)
- Net4x.ProjectFormat.Library (>= 1.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
-
.NETFramework 4.5
- Net4x.InputBoxLibrary.WinForms (>= 2.0.0.26250)
- Net4x.ProjectFormat.Library (>= 1.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
-
.NETStandard 2.0
- Net4x.ProjectFormat.Library (>= 1.0.0.26250)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Net4x.InstallerLibrary:
| Package | Downloads |
|---|---|
|
Net4x.InstallerTool
Installer Library Tool |
|
|
Net4x.UnitTestsLibraryTool
UnitTest Library Tool |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.8.1.26250 | 56 | 9/7/2026 |
| 1.8.1 | 421 | 4/2/2025 |
| 1.8.0 | 332 | 3/31/2025 |
| 1.7.0 | 676 | 8/27/2023 |
| 1.7.0-at20230506055621 | 598 | 5/7/2023 |