Hyprx.DotEnv 0.0.0-alpha.0

This is a prerelease version of Hyprx.DotEnv.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Hyprx.DotEnv --version 0.0.0-alpha.0
                    
NuGet\Install-Package Hyprx.DotEnv -Version 0.0.0-alpha.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="Hyprx.DotEnv" Version="0.0.0-alpha.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hyprx.DotEnv" Version="0.0.0-alpha.0" />
                    
Directory.Packages.props
<PackageReference Include="Hyprx.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 Hyprx.DotEnv --version 0.0.0-alpha.0
                    
#r "nuget: Hyprx.DotEnv, 0.0.0-alpha.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 Hyprx.DotEnv@0.0.0-alpha.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=Hyprx.DotEnv&version=0.0.0-alpha.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Hyprx.DotEnv&version=0.0.0-alpha.0&prerelease
                    
Install as a Cake Tool

Hyprx.DotEnv

Overview

An implementation of dotenv for parsing and writing .env files.

This library can:

  • expand environment variables such as MYVAR=${HOME}/.config
  • perserves the order of the environment variables defined in the file.
  • can parse and write comments.
  • can load multiple files and expand the environment variables.
  • can handle extra parsing features such as json, yaml, and bacticks.
  • avoids reflection to help with AOT scenarios.

Usage

using Hyprx.DotEnv;

var doc = DotEnvSerializer.DeserializeDocument(
    """
    # COMMENT
    KEY=VALUE

    MULTILINE=" my 
    value
    spans
    multiple
    lines"
    single='single value'
    PF="${USERPROFILE:-notfound}"
    """);

foreach(var node in doc) 
{
    if (node is DotEnvEmptyLine)
        Console.WriteLine("");

    if (node is DotEnvComment comment)
        Console.WriteLine($"#{comment.Value}");

    if (node is DotEnvEntry entry)
        Console.WriteLine($"{entry.Key}=\"{entry.Value}\"");
}

var content = DotEnvSerializer.DeserializeDocument(doc);
Console.WriteLine(content);

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 (2)

Showing the top 2 NuGet packages that depend on Hyprx.DotEnv:

Package Downloads
Hyprx.Rex.Console

The Hyprx.Rex.Console package enables you to create a cli task runner or a make-like experience in .NET within console projects or using `dotnet run app.cs` (single files).

Hyprx.DotEnv.Expansion

Expand variables and perform command substitution in dotenv (.env) files.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.0-alpha.3 120 7/10/2025
0.0.0-alpha.2 114 7/10/2025
0.0.0-alpha.1 122 6/25/2025
0.0.0-alpha.0 131 6/17/2025

# Hyprx.DotEnv Changelog

## 0.0.0-alpha.0

An implementation of dotenv for parsing and writing .env files.

This library can:

- expand environment variables such as `MYVAR=${HOME}/.config`
- perserves the order of the environment variables defined in the file.
- can parse and write comments.
- can load multiple files and expand the environment variables.
- can handle extra parsing features such as json, yaml, and bacticks.  
- avoids reflection to help with AOT scenarios.