Net4x.DapperLibrary.Installation 1.9.9

dotnet add package Net4x.DapperLibrary.Installation --version 1.9.9
                    
NuGet\Install-Package Net4x.DapperLibrary.Installation -Version 1.9.9
                    
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="Net4x.DapperLibrary.Installation" Version="1.9.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Net4x.DapperLibrary.Installation" Version="1.9.9" />
                    
Directory.Packages.props
<PackageReference Include="Net4x.DapperLibrary.Installation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Net4x.DapperLibrary.Installation --version 1.9.9
                    
#r "nuget: Net4x.DapperLibrary.Installation, 1.9.9"
                    
#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.
#:package Net4x.DapperLibrary.Installation@1.9.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Net4x.DapperLibrary.Installation&version=1.9.9
                    
Install as a Cake Addin
#tool nuget:?package=Net4x.DapperLibrary.Installation&version=1.9.9
                    
Install as a Cake Tool

DapperLibrary.Installation

Helpers to detect and perform basic installation tasks for native components (MSI installers) and to assist Docker installation checks on supported runtimes.

Overview

This project contains small utilities used by the DapperLibraries to ensure required native components or tools are available on the host (for example, LocalDB, Docker, or other MSI-packaged dependencies). It provides a minimal download abstraction, a registry-based installed-apps enumerator and an installer orchestrator that can invoke MSIs silently.

Main types

  • InstallationEnsurer / InstallationEnsurerInternal

    • Entry point: InstallationEnsurer.GetInstance(ILogger? logger) returns an IInstallationEnsurer.
    • EnsureIsInstalled(IFileDownloader fileDownloader, string urlOrPath, bool useDocker, params string[] keywords) attempts to detect a previously installed product by scanning the Windows uninstall registry for display names that contain all provided keywords.
    • If the product is not found, the method will copy or download the provided installer (urlOrPath) to a temporary .msi file and invoke msiexec.exe with quiet install arguments.
    • On .NET 6+ builds and on Windows the implementation may attempt Docker installer actions if useDocker is true (calls into DapperLibrary.Docker helpers conditionally).
  • IFileDownloader / FileDownloader / InstallationWebClient

    • IFileDownloader is a tiny abstraction: void DownloadFile(string urlOrPath, string fileName).
    • FileDownloader.Instance uses InstallationWebClient (a thin wrapper around System.Net.WebClient) to download the installer when urlOrPath is a remote URI.

Key behaviors

  • Installed-apps detection is Windows-specific and reads:

    • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (32-bit view) and, on 64-bit OS, the 64-bit view as well.
    • It collects DisplayName values and checks whether the provided keywords all appear in a display name.
  • Installer execution

    • When no matching installed product is found the installer file (remote URL or local path) is copied to a temporary .msi location and executed via msiexec.exe with a /i ... /q argument to perform a quiet install.
    • The temporary file is deleted after the installer process exits (best-effort; deletion failures are logged but do not fail the method).
  • Docker support

    • When compiled for modern runtimes (NET6_0_OR_GREATER) the internal ensurer checks RuntimeInformation and will attempt to invoke DockerInstaller.Instance.EnsureIsInstalled() when useDocker is requested on Windows. The Docker installation flow is platform-specific and may require elevation.

Usage example

var logger = /* obtain logger or null */;
var ensurer = InstallationEnsurer.GetInstance(logger);
var downloader = FileDownloader.Instance; // implements IFileDownloader

// Ensure a component is installed by providing a URL or local path to an MSI
bool installed = ensurer.EnsureIsInstalled(downloader, "https://example.com/mycomponent.msi", useDocker: false, "Component", "Vendor");

Important notes and safety

  • The registry-based detection only works on Windows. GetInstalledApps() relies on the Windows registry and will not function on non-Windows platforms.
  • Running installers programmatically requires caution: the library invokes msiexec.exe and executes downloaded binaries. Only use trusted installer URLs/paths.
  • The code attempts best-effort cleanup of temporary files; antivirus or permission issues may prevent deletion.
  • Docker installer flows (automatic download/installation) require administrator privileges and are platform-specific. On macOS the code will recommend manual installation.

Compatibility

  • The project contains conditional compilation for multiple target frameworks. The registry/msiexec flow is intended for Windows/.NET Framework and modern .NET builds running on Windows.
  • For cross-platform scenarios, prefer using platform-appropriate package management or container-based alternatives rather than invoking MSIs.

Extensibility

  • Implement IFileDownloader to provide custom download behavior (proxy, authenticated downloads, local caching).
  • Swap the IFile/InputOutput.Instance implementation used by the internal ensurer if you need custom I/O behavior in tests.

License / Contributing

See repository root for license and contribution guidelines.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 is compatible.  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 Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Net4x.DapperLibrary.Installation:

Package Downloads
Net4x.DapperLibrary.MockSqlServer

Package Description

Net4x.Xsd2Db.Base

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.9.9 23 12/22/2025
1.6.0.12 151 12/12/2025
1.6.0.11 136 12/12/2025
1.6.0.10 448 12/9/2025
1.6.0.9 221 12/4/2025
1.6.0.8 209 12/4/2025
1.6.0.7 273 11/30/2025
1.6.0.6 204 11/27/2025
1.6.0.5 252 11/22/2025
1.6.0.4 160 11/16/2025
1.6.0.3 202 11/15/2025
1.6.0.2 296 11/14/2025
1.6.0.1 260 11/10/2025
1.6.0 235 11/9/2025
1.5.0.3 231 11/5/2025
1.5.0.2 250 11/3/2025
1.5.0.1 225 11/3/2025
1.5.0 181 10/26/2025
1.4.1.6 216 10/24/2025
1.4.1.5 214 10/22/2025
1.4.1.4 252 10/22/2025
1.4.1.2 235 5/30/2025
1.4.1.1 240 4/30/2025
1.4.1 239 4/30/2025
1.4.0 286 3/31/2025
1.1.0 1,378 8/26/2023
1.1.0-at20230506034359 988 5/7/2023