Soenneker.Utils.Runtime 4.0.1082

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

alternate text is missing from this package README image Soenneker.Utils.Runtime

A collection of helpful runtime-based operations.

Installation

dotnet add package Soenneker.Utils.Runtime

Quick start

using Soenneker.Utils.Runtime;

Call the static RuntimeUtil methods directly; no dependency-injection registration is required.

Platform checks

if (RuntimeUtil.IsWindows())
{
    // Windows-specific behavior
}

bool browser = RuntimeUtil.IsBrowser();

IsWindows, IsMacOs, IsLinux, IsAndroid, IsBrowser, and IsIos directly wrap the corresponding OperatingSystem checks. They describe the current runtime platform; they do not infer a deployment environment or distribution.

Hosting environment hints

bool actions = RuntimeUtil.IsGitHubAction;
bool functions = RuntimeUtil.IsAzureFunction;
bool appService = RuntimeUtil.IsAzureAppService;
  • IsGitHubAction requires GITHUB_ACTIONS=true; a generic CI=true marker is not enough.
  • IsAzureFunction checks for a non-empty FUNCTIONS_WORKER_RUNTIME value.
  • IsAzureAppService checks for a non-empty WEBSITE_SITE_NAME or WEBSITE_INSTANCE_ID value.

Each property caches its first result for the process lifetime. Set environment variables before the first access; later environment changes are not observed.

Container detection

bool container = await RuntimeUtil.IsContainer(cancellationToken);

Detection first checks DOTNET_RUNNING_IN_CONTAINER/DOTNET_RUNNING_IN_CONTAINERS. On Linux it then checks /.dockerenv and scans /proc/1/cgroup for Docker, Kubernetes, or containerd markers. On Windows it checks the common container identity and ContainerType registry value. Other platforms return false.

The first successful detection result is cached. The cancellation token applies while the initial Linux cgroup file is read; later calls normally return the cached value. Detection is heuristic and can have false negatives on container runtimes that expose none of these markers. Do not use it as a security boundary or authorization decision. Filesystem access errors from the Linux cgroup probe can propagate.

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

Showing the top 5 NuGet packages that depend on Soenneker.Utils.Runtime:

Package Downloads
Soenneker.Utils.Json

Serializes, deserializes, validates, formats, and writes JSON with System.Text.Json or Newtonsoft.Json.

Soenneker.Utils.HttpClientCache

Providing thread-safe singleton HttpClients

Soenneker.Git.Util

Asynchronous Git operations, repository discovery, and bounded batch processing using bundled Git distributions.

Soenneker.Utils.Process

A utility library implementing useful process operations

Soenneker.Utils.LogPath

Chooses a writable log-file path across cloud, container, CI, and local environments.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1086 15 8/31/2026
4.0.1085 650 8/31/2026
4.0.1084 3,192 8/31/2026
4.0.1083 35 8/31/2026
4.0.1082 3,363 8/31/2026
4.0.1081 1,395 8/30/2026
4.0.1080 40 8/30/2026
4.0.1079 1,382 8/30/2026
4.0.1078 52 8/30/2026
4.0.1077 3,966 8/30/2026
4.0.1076 1,970 8/30/2026
4.0.1075 55 8/30/2026
4.0.1074 4,583 8/30/2026
4.0.1073 62 8/30/2026
4.0.1072 1,997 8/29/2026
4.0.1070 11,517 8/29/2026
4.0.1068 4,352 8/29/2026
4.0.1067 42,876 8/26/2026
4.0.1066 5,566 8/26/2026
4.0.1065 6,464 8/25/2026
Loading failed

Update dependency Soenneker.Utils.AsyncSingleton to 4.0.829 (#1507)