VOOZH about

URL: https://www.nuget.org/packages/FSharp.DI/

⇱ NuGet Gallery | FSharp.DI 1.0.0




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
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 file for details.

Author

Faisal Waris — © 2026

Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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
RTOpenAI.Api

F# library wrapping the OpenAI realtime (voice) API

FsAICore

Utility AI functions shared by multiple packages

FsPlan

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

RTFlow

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

FsPlay

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

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 281 4/20/2026