FSharp.DI 1.0.0

dotnet add package FSharp.DI --version 1.0.0
                    
NuGet\Install-Package FSharp.DI -Version 1.0.0
                    
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="FSharp.DI" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FSharp.DI" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="FSharp.DI" />
                    
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 FSharp.DI --version 1.0.0
                    
#r "nuget: FSharp.DI, 1.0.0"
                    
#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 FSharp.DI@1.0.0
                    
#: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=FSharp.DI&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=FSharp.DI&version=1.0.0
                    
Install as a Cake Tool

FSharp.DI

Lightweight functional helpers for Microsoft dependency injection and logging in F#.

Quick Start

  • Target framework: .NET 10.0
  • Install the package (when published):
dotnet add package FSharp.DI

Configure Logging in Program.fs

This is a minimal example of an F# app configuring Microsoft.Extensions.Logging, initializing FSharp.DI, and then calling a module that has a lazy logger bound with let:

open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Logging
open FSharp.DI
open LazyLoggerSample.SampleModule

[<EntryPoint>]
let main _ =
    let services =
        ServiceCollection()
            .AddLogging(fun logging ->
                logging.ClearProviders() |> ignore
                logging.SetMinimumLevel(LogLevel.Information) |> ignore
                logging.AddSimpleConsole(fun options ->
                    options.TimestampFormat <- "HH:mm:ss "
                    options.SingleLine <- true
                ) |> ignore
            )
            .BuildServiceProvider()

    DI.init services
    run 42
    0

Module-Level Lazy Logger Example

The sample module keeps a lazy logger in a normal module-level let binding:

module LazyLoggerSample.SampleModule

open FSharp.DI

type SampleModuleLog = class end

let private log = DI.loggerLazy<SampleModuleLog>()

let run orderId =
    log.Value.info $"Starting work for order {orderId}"
    log.Value.warn "Logger created on first use"

The let binding is created when the module loads, but the actual logger is not resolved until the first log.Value access. That means the pattern is safe as long as DI.init runs before run is called.

A runnable version of this example is included in samples/LazyLoggerSample/.

License

This project is licensed under the MIT License — see the LICENSE file for details.

Author

Faisal Waris — © 2026

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on FSharp.DI:

Package Downloads
FsAICore

Utility AI functions shared by multiple packages

RTOpenAI.Api

F# library wrapping the OpenAI realtime (voice) API

FsPlan

A library for organizing tasks into a plan with either linear or graphical flow

FsPlay

Maui library for programmatically controlling mobile embedded browsers, e.g. via a computer-use-agent

RTFlow

A multi-agent AI application framework - capable of handling realtime applications

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 166 4/20/2026