Soenneker.Utils.Runtime 11.0.1157

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

Detects the current operating system, common hosting environments, and container execution.

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 net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

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

Package Downloads
Soenneker.Utils.HttpClientCache

Providing thread-safe singleton HttpClients

Soenneker.Utils.Json

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

Soenneker.Utils.Process

Starts, captures, streams, probes, and terminates operating-system processes.

Soenneker.Utils.LogPath

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

Soenneker.Utils.Paths.Resources

Resolves Resources directories across local, Azure, and GitHub Actions environments.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1157 0 10/26/2026
11.0.1156 0 10/26/2026
11.0.1155 0 10/26/2026
11.0.1154 16 10/26/2026
11.0.1153 39 10/26/2026
4.0.1152 37,838 10/15/2026
4.0.1151 84 10/15/2026
4.0.1150 90 10/15/2026
4.0.1149 119 10/14/2026
4.0.1148 2,955 10/14/2026
4.0.1145 16,101 10/14/2026
4.0.1144 88 10/14/2026
4.0.1135 10,971 10/13/2026
4.0.1134 1,300 10/13/2026
4.0.1130 27,196 10/12/2026
4.0.1129 2,683 10/12/2026
4.0.1128 11,647 10/11/2026
4.0.1127 98 10/11/2026
4.0.1126 92 10/11/2026
4.0.1124 4,805 10/11/2026
Loading failed

Updated Soenneker.Utils.AsyncSingleton to 11.0.886