FSharp.DI
1.0.0
dotnet add package FSharp.DI --version 1.0.0
NuGet\Install-Package FSharp.DI -Version 1.0.0
<PackageReference Include="FSharp.DI" Version="1.0.0" />
<PackageVersion Include="FSharp.DI" Version="1.0.0" />
<PackageReference Include="FSharp.DI" />
paket add FSharp.DI --version 1.0.0
#r "nuget: FSharp.DI, 1.0.0"
#:package FSharp.DI@1.0.0
#addin nuget:?package=FSharp.DI&version=1.0.0
#tool nuget:?package=FSharp.DI&version=1.0.0
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 | Versions 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. |
-
net10.0
- FSharp.Core (>= 10.1.201)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0 && < 11.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0 && < 11.0.0)
- Microsoft.Extensions.Logging.Console (>= 10.0.0 && < 11.0.0)
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 |