TedToolkit.CiContext
2026.8.14
dotnet add package TedToolkit.CiContext --version 2026.8.14
NuGet\Install-Package TedToolkit.CiContext -Version 2026.8.14
<PackageReference Include="TedToolkit.CiContext" Version="2026.8.14" />
<PackageVersion Include="TedToolkit.CiContext" Version="2026.8.14" />
<PackageReference Include="TedToolkit.CiContext" />
paket add TedToolkit.CiContext --version 2026.8.14
#r "nuget: TedToolkit.CiContext, 2026.8.14"
#:package TedToolkit.CiContext@2026.8.14
#addin nuget:?package=TedToolkit.CiContext&version=2026.8.14
#tool nuget:?package=TedToolkit.CiContext&version=2026.8.14
TedToolkit.CiContext
TedToolkit.CiContext supplies the provider-neutral primitives shared by the CI provider packages.
Install
dotnet add package TedToolkit.CiContext
Raw Environment Access
using TedToolkit.Ci;
string? value = CiEnvironment.GetRawValue("CUSTOM_CI_VALUE");
GetRawValue reads the current process environment on every call. It returns null when the variable is absent and rejects a null or empty name.
Stable Typed Values
The common package owns the reusable environment-value formats used by provider packages:
int? attempt = CiEnvironment.GetInt32("BUILD_ATTEMPT");
long? runId = CiEnvironment.GetInt64("BUILD_RUN_ID");
Uri? server = CiEnvironment.GetAbsoluteUri("CI_SERVER_URL");
bool? enabled = CiEnvironment.GetBoolean("CI_FEATURE");
DateTimeOffset? startedAt = CiEnvironment.GetDateTimeOffset("CI_STARTED_AT");
TimeSpan? timeout = CiEnvironment.GetTimeSpanFromSeconds("CI_TIMEOUT");
DirectoryPath? workspace = CiEnvironment.GetDirectoryPath("CI_WORKSPACE");
GetBoolean accepts true, false, yes, and no without regard to letter case, plus exact 1 and 0. Missing values return null. Malformed values throw FormatException without including their original text.
Map a documented closed string set directly on its enum members:
public enum DeploymentTier
{
[CiEnumValue("staging")]
Staging,
[CiEnumValue("production")]
Production,
}
DeploymentTier? tier = CiEnvironment.GetEnumValue<DeploymentTier>("DEPLOYMENT_TIER");
Enum matching is ordinal and case-sensitive. Mapping metadata is initialized once by each closed generic cache and reused for later reads; no extra Lazy<T> layer is used. Every member must have at least one mapping, and one enum type cannot map the same string to multiple members.
Redacting Sensitive Values
using TedToolkit.Ci;
CiSecret<string> secret = "glpat-1234567890";
Console.WriteLine(secret); // [REDACTED]7890
string value = secret.Reveal(); // glpat-1234567890
CiSecret<T> is a readonly struct, so implicit conversion does not allocate a wrapper object. ToString() calls the wrapped value's own ToString() and shows only the last four characters when its representation is at least 12 characters long. Shorter values and an uninitialized default wrapper return [REDACTED]. The type is not encryption and does not protect values passed to serializers, reflection, logging destructurers, or code that calls Reveal().
Variable Metadata
Provider properties use the sealed CiVariableAttribute directly, whose Name property exposes the exact environment-variable name. Provider-specific facts use separate attributes. The common package deliberately does not define a normalized provider context. Providers select the appropriate named reader, such as an exact presence marker or an explicit duration unit.
Target Frameworks
net6.0, net7.0, net8.0, net9.0, net10.0, net472, net48, netstandard2.0, and netstandard2.1.
Related Documentation
License
Licensed under LGPL-3.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- TedToolkit.FileSystem (>= 2026.7.15)
-
.NETFramework 4.8
- TedToolkit.FileSystem (>= 2026.7.15)
-
.NETStandard 2.0
- TedToolkit.FileSystem (>= 2026.7.15)
-
.NETStandard 2.1
- TedToolkit.FileSystem (>= 2026.7.15)
-
net10.0
- TedToolkit.FileSystem (>= 2026.7.15)
-
net6.0
- TedToolkit.FileSystem (>= 2026.7.15)
-
net7.0
- TedToolkit.FileSystem (>= 2026.7.15)
-
net8.0
- TedToolkit.FileSystem (>= 2026.7.15)
-
net9.0
- TedToolkit.FileSystem (>= 2026.7.15)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on TedToolkit.CiContext:
| Package | Downloads |
|---|---|
|
TedToolkit.CiContext.GitLab
Strongly typed access to GitLab predefined CI/CD environment variables. |
|
|
TedToolkit.CiContext.GitHubActions
Strongly typed access to GitHub Actions default environment variables. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.8.14 | 172 | 8/14/2026 |