Soenneker.Utils.Runtime 11.0.1175

Prefix Reserved
dotnet add package Soenneker.Utils.Runtime --version 11.0.1175
                    
NuGet\Install-Package Soenneker.Utils.Runtime -Version 11.0.1175
                    
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.1175" />
                    
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.1175" />
                    
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.1175
                    
#r "nuget: Soenneker.Utils.Runtime, 11.0.1175"
                    
#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.1175
                    
#: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.1175
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.Runtime&version=11.0.1175
                    
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 (7)

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.1175 18,626 11/19/2026
11.0.1174 3,973 11/18/2026
11.0.1173 8,699 11/18/2026
11.0.1172 76 11/18/2026
11.0.1171 2,736 11/18/2026
11.0.1170 35,352 11/15/2026
11.0.1169 16,033 11/11/2026
11.0.1168 24,257 11/11/2026
11.0.1167 19,019 11/11/2026
11.0.1166 6,977 11/11/2026
11.0.1164 103 11/11/2026
11.0.1163 10,309 11/11/2026
11.0.1162 96 11/10/2026
11.0.1161 60,435 11/3/2026
11.0.1160 12,089 11/3/2026
11.0.1159 5,036 11/3/2026
11.0.1158 11,693 11/2/2026
11.0.1157 65,322 10/26/2026
11.0.1156 2,361 10/26/2026
11.0.1155 3,453 10/26/2026
Loading failed

Updated Multiple NuGet packages