Bodu.Text.DotEnv 1.0.0

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

Bodu.Text.DotEnv

API stability — Stable. The public API surface is committed; breaking changes are reserved for a major-version bump per SemVer.

A DotEnv (.env) library for .NET 8, shaped after System.Text.Json: a typed settings serializer over a low-level forward-only token reader and writer, with both a mutable and a read-only document object model. The dialect follows the mainstream dotenv implementations — export prefixes, double/single quoting with escapes, inline comments — and values are deliberately literal: no ${VAR} interpolation happens at parse time.

Installation

dotnet add package Bodu.Text.DotEnv

Targets net8.0. Also available through the Bodu.Text.Formats umbrella package.

API shape

Type(s) Namespace Role
DotEnvSerializer / DotEnvSerializerOptions / DotEnvSerializerDefaults Bodu.Text.DotEnv Static serializer entry point, configuration, and presets (Web = SCREAMING_SNAKE_CASE, case-insensitive).
DotEnvFormatException / DotEnvSerializationException Bodu.Text.DotEnv Failures split by cause: malformed input vs. values that cannot be mapped.
Utf8DotEnvReader (+ DotEnvReaderOptions) Bodu.Text.DotEnv.Reader Forward-only ref struct token reader (export detection, quoting, inline comments).
Utf8DotEnvWriter (+ DotEnvWriterOptions) Bodu.Text.DotEnv.Writer Forward-only ref struct token writer.
DotEnvDocument / DotEnvElement / DotEnvProperty Bodu.Text.DotEnv.Document Read-only document object model over the flat key/value object.
DotEnvNode / DotEnvObject / DotEnvValue Bodu.Text.DotEnv.Nodes Mutable document object model; preserves each entry's export flag.
using Bodu.Text.DotEnv;

sealed class Settings
{
    public string? AppEnv { get; set; }   // binds APP_ENV
    public int AppPort { get; set; }      // binds APP_PORT
}

Settings settings = DotEnvSerializer.Deserialize<Settings>(
    envText, new DotEnvSerializerOptions(DotEnvSerializerDefaults.Web));
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bodu.Text.DotEnv:

Package Downloads
Bodu.Text.Formats

Umbrella package for the Bodu line-oriented text formats on .NET 8 — delimited text (RFC 4180 CSV/TSV), DotEnv, and INI. References Bodu.Text.Delimited, Bodu.Text.DotEnv, and Bodu.Text.Ini, each a System.Text.Json-shaped library with a ref-struct Utf8 reader/writer pair, a serializer, a mutable node DOM, and a read-only document DOM.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 48 9/24/2026
0.7.0 102 9/24/2026
0.6.0 64 9/24/2026
0.5.0 68 9/23/2026