WixSharpFluent 1.4.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package WixSharpFluent --version 1.4.5
NuGet\Install-Package WixSharpFluent -Version 1.4.5
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="WixSharpFluent" Version="1.4.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WixSharpFluent --version 1.4.5
#r "nuget: WixSharpFluent, 1.4.5"
#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 WixSharpFluent as a Cake Addin
#addin nuget:?package=WixSharpFluent&version=1.4.5

// Install WixSharpFluent as a Cake Tool
#tool nuget:?package=WixSharpFluent&version=1.4.5

WixSharpFluent

An extension, and fluent extension methods collection for: https://github.com/oleg-shilo/wixsharp

Typical use case

Providing data from build scripts:

In your installer projects (not product projects) you might want to provide additonal information. This can easily be done with Assembly Attributes:

  • WixSharp.Fluent.Attributes.*
  • Or the default Assembly Attributes

Which are read when calling respective methods from:

  • WixSharp.Fluent.Extensions.AssemblyAttributeExtensions
  • Or by the Setters for Project and in some cases when it's viable for Bundle (Can be easily checked by parameters list if it accepts a Assembly)

It is also possible to read additonal information from the product assemblies. Just Provide The Assembly as parameter.

CSPROJ

  <ItemGroup>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyInsideInstallerNameAttribute">
      <ProductNameVersion>$(ProductName) $(ProductShortVersion)</ProductNameVersion>
      <ReleaseCycle>$(ReleaseCycle)</ReleaseCycle>
      
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyExecutableNameAttribute">
      <ExecutableName>$(Product)</ExecutableName>
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyDefinesAttribute">
      <DefineConstants>$(DefineConstants)</DefineConstants>
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyBundleUpgradeCodeAttribute">
      <UpgradeCode>**CONSTANT UNIQUE GUID HERE**</UpgradeCode>
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyProjectUpgradeCodeAttribute">
      <UpgradeCode>**(ANOTHER) CONSTANT UNIQUE GUID HERE**</UpgradeCode>
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyProgramFilesPathAttribute">
      <Path>$(Company)\$(Product)\</Path>
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyStartMenuPathAttribute">
      <Path>$(Company)\$(Product)\</Path>
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblySourcePathAttribute">
      <Path>$(PackagePath)\bin\$(Configuration)\</Path>
    </AssemblyAttribute>
    <AssemblyAttribute Include="WixSharp.Fluent.Attributes.AssemblyBootstrapperAttribute">
      ...Assembly Bootstrapper (Bundle) Settings
    </AssemblyAttribute>
    ...Other data...
  </ItemGroup>

Project:

Assuming all data is provided from Assembly attributes of the Intaller project:

namespace Installer
{
  internal static class Product
  {
    public static readonly File mainExecutable = new File($@"{GetSourcePath()}\Product.exe").SetFireWallException();
    internal static readonly string mainFileName = System.IO.Path.GetFileName(mainExecutable.Name);
    internal static readonly string prettyName = GetExecutableName();

    internal static Project Create()
    {
      var product = new Project()
        .SetDefaults()
        //.SetPreserveTempFiles(true)
        .SetMajorUpgrade($"A Newer Version of {prettyName} is already installed.");

      //product.UI = WUI.WixUI_ProgressOnly;

      product.AddDirs(
          new InstallDir(InstallationFolderId.ToId(),GetInstallationPath(),
              new DirFiles($@"{GetSourcePath()}\*.*", f => !f.EndsWith(mainFileName) && !f.EndsWith(".pdb")),//'!f.EndsWith(exeFileName)' To not duplicate the file below
              mainExecutable,
              ),

          new Dir(GetStartMenuPath(),
              new ExeFileShortcut("ApplicationStartMenuShortcut".ToId(),
                      prettyName, $"[{InstallationFolderId}]{mainFileName}", arguments: "")
              {
                WorkingDirectory = $"[{InstallationFolderId}]",
                IconFile = product.GetIconPath(),
              }
            )
      );

      return product;
    }
  }
}

Bundle:

namespace Installer
{
  public static class Program 
  {
    static void Main()
    {
      var project = Product.Create();
      new Bundle()
        .SetDefaults()
        .SetFromProject(project)
        .AddNetFxWeb48()//Redist
        .AddMsiProject(project)
        .Build();
    }
  }
}

Util Extensions

PathExtensions

Allow to separate paths/string easily by ';' or '', while replacing all '/' with ''. Usefull When dealing with multiple paths/constants in Assembly Attributes.

FeatureExtensions/WixEntityExtensions

Help to make Features and entities.

Feature setting with bootstrappervariables

It is also possible to use custom conditions/variable names.

But using custom variable names enforces to use custom conditions!

//In Project or some Constant Pool Class
internal static readonly Feature docs = new Feature("Documentation").SetSmart();

//In project
project.AddSmartFeatureProperty(docs);
...Somewhere in your Dir tree or file listings...
file.SetFeatureAndCondition(docs)
files.SetFeaturesAndConditions(docs)
...

//In Bundle
bundle.AddMsiProject(project, properties: $"{docs.GetPropertyName()}=[**ButtonNameFromBootstrapperTheme**]")
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.6 123 4/16/2024
1.4.5 88 1/19/2024
1.4.4 158 12/11/2023
1.4.3 1,020 2/7/2023
1.4.2 222 2/7/2023
1.4.1 234 2/7/2023
1.4.0 225 2/7/2023
1.3.3 221 2/7/2023
1.3.2 227 2/7/2023
1.3.1 238 2/6/2023
1.3.0 398 1/31/2023
1.2.6 247 1/31/2023
1.2.5 225 1/31/2023
1.2.4 249 1/31/2023
1.2.3 275 1/26/2023
1.2.2 283 1/20/2023
1.2.1 269 1/20/2023
1.2.0 248 1/20/2023
1.1.4 289 1/13/2023
1.1.3 276 1/13/2023
1.1.2 275 1/13/2023
1.1.1 274 1/13/2023
1.1.0 277 12/9/2022
1.0.3 273 12/7/2022
1.0.2 288 12/7/2022
1.0.1 282 12/6/2022