Run-time configuration options for globalization

Invariant mode

  • Determines whether a .NET Core app runs in globalization invariant mode without access to culture-specific data and behavior or whether it has access to cultural data.
  • Default: Run the app with access to cultural data (false).
  • For more information, see .NET Core globalization invariant mode.
Setting name Values
runtimeconfig.json System.Globalization.Invariant false - access to cultural data
true - run in invariant mode
MSBuild property InvariantGlobalization false - access to cultural data
true - run in invariant mode
Environment variable DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 0 - access to cultural data
1 - run in invariant mode

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Globalization.Invariant": true
      }
   }
}

Project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <InvariantGlobalization>true</InvariantGlobalization>
  </PropertyGroup>

</Project>

Era year ranges

Setting name Values
runtimeconfig.json Switch.System.Globalization.EnforceJapaneseEraYearRanges false - relaxed range checks
true - overflows cause an exception
Environment variable N/A N/A

Japanese date parsing

  • Determines whether a string that contains either "1" or "Gannen" as the year parses successfully or whether only "1" is supported.
  • Default: Parse strings that contain either "1" or "Gannen" as the year (false).
  • For more information, see Represent dates in calendars with multiple eras.
Setting name Values
runtimeconfig.json Switch.System.Globalization.EnforceLegacyJapaneseDateParsing false - "Gannen" or "1" is supported
true - only "1" is supported
Environment variable N/A N/A

Japanese year format

Setting name Values
runtimeconfig.json Switch.System.Globalization.FormatJapaneseFirstYearAsANumber false - format as "Gannen"
true - format as number
Environment variable N/A N/A