DotEnv.Dotenvx 1.0.0

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

DotEnv for .NET

A .NET configuration provider for dotenv files created and encrypted by dotenvx.

Usage

using DotEnv;

var builder = WebApplication.CreateBuilder(args);
builder.Configuration
    .AddDotEnv()                 // .env, then .env.{DOTNET_ENVIRONMENT}
    .AddEnvironmentVariables(); // deployment variables take final precedence

Encrypted values are decrypted automatically. Keep the matching dotenvx private key in .env.keys for local development, or provide DOTENV_PRIVATE_KEY through your deployment environment.

DOTENV_PUBLIC_KEY="03..."
API_KEY="encrypted:..."

Environment-specific files use dotenvx key names such as DOTENV_PRIVATE_KEY_PRODUCTION for .env.production.

Options

builder.Configuration.AddDotEnv(".env", options =>
{
    options.EnvironmentName = builder.Environment.EnvironmentName;
    options.KeysFilePath = "/run/secrets/.env.keys";
    options.Optional = false;
    options.SetEnvironmentVariables = true;
    options.Overload = false;
});

Overload has the same meaning as dotenvx's --overload: when false, existing process environment values are preserved. The configuration provider still contains the parsed file values, so add .AddEnvironmentVariables() afterward when deployment variables should override configuration too.

The parser supports quoted and multiline values, inline comments, export, equals signs in values, and dotenvx variable expansion including ${NAME:-default}. You can parse text directly with DotEnvParser.Parse(source).

Command substitution and external secret URI resolution ($(command), bw://, and op://) are intentionally not executed by this in-process configuration provider.

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 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 116 9/6/2026