WixSharpFluent 1.2.6

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

// Install WixSharpFluent as a Cake Tool
#tool nuget:?package=WixSharpFluent&version=1.2.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.
  • .NETFramework 4.8

    • No dependencies.

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 192 4/16/2024
1.4.5 122 1/19/2024
1.4.4 198 12/11/2023
1.4.3 1,061 2/7/2023
1.4.2 255 2/7/2023
1.4.1 260 2/7/2023
1.4.0 255 2/7/2023
1.3.3 255 2/7/2023
1.3.2 252 2/7/2023
1.3.1 267 2/6/2023
1.3.0 435 1/31/2023
1.2.6 274 1/31/2023
1.2.5 260 1/31/2023
1.2.4 280 1/31/2023
1.2.3 309 1/26/2023
1.2.2 313 1/20/2023
1.2.1 303 1/20/2023
1.2.0 279 1/20/2023
1.1.4 321 1/13/2023
1.1.3 312 1/13/2023
1.1.2 306 1/13/2023
1.1.1 301 1/13/2023
1.1.0 307 12/9/2022
1.0.3 301 12/7/2022
1.0.2 321 12/7/2022
1.0.1 307 12/6/2022