DotEnv.Dotenvx
1.0.0
dotnet add package DotEnv.Dotenvx --version 1.0.0
NuGet\Install-Package DotEnv.Dotenvx -Version 1.0.0
<PackageReference Include="DotEnv.Dotenvx" Version="1.0.0" />
<PackageVersion Include="DotEnv.Dotenvx" Version="1.0.0" />
<PackageReference Include="DotEnv.Dotenvx" />
paket add DotEnv.Dotenvx --version 1.0.0
#r "nuget: DotEnv.Dotenvx, 1.0.0"
#:package DotEnv.Dotenvx@1.0.0
#addin nuget:?package=DotEnv.Dotenvx&version=1.0.0
#tool nuget:?package=DotEnv.Dotenvx&version=1.0.0
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 | Versions 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. |
-
net10.0
- BouncyCastle.Cryptography (>= 2.7.0)
- Microsoft.Extensions.Configuration (>= 10.0.11)
-
net8.0
- BouncyCastle.Cryptography (>= 2.7.0)
- Microsoft.Extensions.Configuration (>= 10.0.11)
-
net9.0
- BouncyCastle.Cryptography (>= 2.7.0)
- Microsoft.Extensions.Configuration (>= 10.0.11)
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 |