Soenneker.Utils.Environment 4.0.729

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

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Utils.Environment

Static helpers for strict environment-variable lookup, cached pipeline detection, and exception-safe machine-name access.

Installation

dotnet add package Soenneker.Utils.Environment

Pipeline detection and delay

Set PipelineEnvironment=true before the process first reads EnvironmentUtil.IsPipeline:

if (EnvironmentUtil.IsPipeline)
{
    await EnvironmentUtil.PipelineDelay(2_000, cancellationToken);
}

IsPipeline parses true case-insensitively and caches the result for the life of the process. Changes to the environment variable after the first read are not observed.

PipelineDelay() waits only when pipeline mode is enabled and the requested delay is positive. It writes an information event through Serilog's global Log when that level is enabled. Outside pipeline mode it returns immediately.

Required variables

string token = EnvironmentUtil.GetVariableStrict("SERVICE_TOKEN");

GetVariableStrict() throws when the variable name or resolved value is null or empty. It does not trim values, so a whitespace-only value is returned unchanged. Avoid including secret values in exception messages or logs at the call site.

Machine name

string machineName = EnvironmentUtil.GetMachineName();

The machine name is cached on first access. If the platform lookup throws, the method logs a warning through Serilog and caches the literal value Unknown instead.

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

Showing the top 4 NuGet packages that depend on Soenneker.Utils.Environment:

Package Downloads
Soenneker.Messages.Base

A fundamental Azure Service Bus message class

Soenneker.Managers.Runners

Handles Runner operations and coordination

Soenneker.AdaptiveCard.Util

A utility library for Adaptive Card construction

Soenneker.Tests.Attributes.Local

Run locally, skip in pipelines.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.729 5,477 9/5/2026
4.0.728 862 9/4/2026
4.0.727 4,593 9/4/2026
4.0.726 276 9/4/2026
4.0.725 14,503 8/31/2026
4.0.724 1,959 8/31/2026
4.0.723 2,746 8/31/2026
4.0.722 258 8/30/2026
4.0.721 644 8/30/2026
4.0.720 1,523 8/30/2026
4.0.719 782 8/30/2026
4.0.717 733 8/30/2026
4.0.716 321 8/30/2026
4.0.715 83 8/30/2026
4.0.714 568 8/30/2026
4.0.712 127 8/29/2026
4.0.711 263 8/29/2026
4.0.710 3,005 8/29/2026
4.0.709 14,058 8/26/2026
4.0.708 715 8/25/2026
Loading failed

Update dependency Soenneker.Extensions.String to 4.0.739 (#887)