TzData.Runtime.AutoInit
1.0.0
dotnet add package TzData.Runtime.AutoInit --version 1.0.0
NuGet\Install-Package TzData.Runtime.AutoInit -Version 1.0.0
<PackageReference Include="TzData.Runtime.AutoInit" Version="1.0.0" />
<PackageVersion Include="TzData.Runtime.AutoInit" Version="1.0.0" />
<PackageReference Include="TzData.Runtime.AutoInit" />
paket add TzData.Runtime.AutoInit --version 1.0.0
#r "nuget: TzData.Runtime.AutoInit, 1.0.0"
#:package TzData.Runtime.AutoInit@1.0.0
#addin nuget:?package=TzData.Runtime.AutoInit&version=1.0.0
#tool nuget:?package=TzData.Runtime.AutoInit&version=1.0.0
TzData.Runtime.AutoInit
Opt-in companion package for TzData.Runtime. It injects a module initializer into
executable projects so TzDataRuntime.Configure() runs before Main — no startup code needed.
<ItemGroup>
<PackageReference Include="TzData.Runtime.AutoInit" Version="1.0.0" />
</ItemGroup>
The initializer only sets TZDIR when it is not already set; it does not set TZ. If you need a
non-UTC local zone, call TzDataRuntime.Configure(defaultTimeZoneId: "...") yourself, or set TZ
in the environment.
Guarantees and limits
- Injected only when
OutputTypeisExeorWinExe. Libraries do not get the initializer, because a library may load after the app has already usedTimeZoneInfo. - Runs once, synchronously, before
Main, for the app assembly. - Exceptions are swallowed: a missing data folder never prevents the app from starting
(
TimeZoneInfothen behaves as if tzdata were absent). - Windows:
Configure()returnsfalse; nothing changes.
Disable
<PropertyGroup>
<TzDataRuntimeAutoInit>false</TzDataRuntimeAutoInit>
</PropertyGroup>
Then call TzDataRuntime.Configure() at startup yourself.
How it works
The package ships:
buildTransitive/TzData.Runtime.AutoInit.targets— adds the injected source only for executable projects;content/TzDataAutoInit.cs— the module initializer that callsTzDataRuntime.Configure().
The package depends on TzData.Runtime so the API and the tzdata folder are available.
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- TzData.Runtime (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 89 | 11/20/2026 |