WixSharpFluent 1.4.6

dotnet add package WixSharpFluent --version 1.4.6                
NuGet\Install-Package WixSharpFluent -Version 1.4.6                
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.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WixSharpFluent --version 1.4.6                
#r "nuget: WixSharpFluent, 1.4.6"                
#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.6

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

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 200 4/16/2024
1.4.5 124 1/19/2024
1.4.4 200 12/11/2023
1.4.3 1,067 2/7/2023
1.4.2 257 2/7/2023
1.4.1 262 2/7/2023
1.4.0 257 2/7/2023
1.3.3 257 2/7/2023
1.3.2 254 2/7/2023
1.3.1 269 2/6/2023
1.3.0 437 1/31/2023
1.2.6 276 1/31/2023
1.2.5 262 1/31/2023
1.2.4 282 1/31/2023
1.2.3 311 1/26/2023
1.2.2 315 1/20/2023
1.2.1 305 1/20/2023
1.2.0 281 1/20/2023
1.1.4 323 1/13/2023
1.1.3 314 1/13/2023
1.1.2 308 1/13/2023
1.1.1 303 1/13/2023
1.1.0 309 12/9/2022
1.0.3 303 12/7/2022
1.0.2 323 12/7/2022
1.0.1 309 12/6/2022