Compilation config settings - .NET (original) (raw)

This article details the settings you can use to configure .NET compilation.

Note

.NET 6 standardizes on the prefix DOTNET_ instead of COMPlus_ for environment variables that configure .NET run-time behavior. However, the COMPlus_ prefix will continue to work. If you're using a previous version of the .NET runtime, you should still use the COMPlus_ prefix for environment variables.

Tiered compilation

Setting name Values
runtimeconfig.json System.Runtime.TieredCompilation true - enabledfalse - disabled
MSBuild property TieredCompilation true - enabledfalse - disabled
Environment variable COMPlus_TieredCompilation or DOTNET_TieredCompilation 1 - enabled0 - disabled

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Runtime.TieredCompilation": false
      }
   }
}

runtimeconfig.template.json file:

{
   "configProperties": {
      "System.Runtime.TieredCompilation": false
   }
}

Project file:

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

  <PropertyGroup>
    <TieredCompilation>false</TieredCompilation>
  </PropertyGroup>

</Project>

Quick JIT

Setting name Values
runtimeconfig.json System.Runtime.TieredCompilation.QuickJit true - enabledfalse - disabled
MSBuild property TieredCompilationQuickJit true - enabledfalse - disabled
Environment variable COMPlus_TC_QuickJit or DOTNET_TC_QuickJit 1 - enabled0 - disabled

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Runtime.TieredCompilation.QuickJit": false
      }
   }
}

runtimeconfig.template.json file:

{
   "configProperties": {
      "System.Runtime.TieredCompilation.QuickJit": false
   }
}

Project file:

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

  <PropertyGroup>
    <TieredCompilationQuickJit>false</TieredCompilationQuickJit>
  </PropertyGroup>

</Project>

Quick JIT for loops

Setting name Values
runtimeconfig.json System.Runtime.TieredCompilation.QuickJitForLoops false - disabledtrue - enabled
MSBuild property TieredCompilationQuickJitForLoops false - disabledtrue - enabled
Environment variable COMPlus_TC_QuickJitForLoops or DOTNET_TC_QuickJitForLoops 0 - disabled1 - enabled

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Runtime.TieredCompilation.QuickJitForLoops": false
      }
   }
}

runtimeconfig.template.json file:

{
   "configProperties": {
      "System.Runtime.TieredCompilation.QuickJitForLoops": false
   }
}

Project file:

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

  <PropertyGroup>
    <TieredCompilationQuickJitForLoops>true</TieredCompilationQuickJitForLoops>
  </PropertyGroup>

</Project>

ReadyToRun

Setting name Values
Environment variable COMPlus_ReadyToRun or DOTNET_ReadyToRun 1 - enabled0 - disabled

Profile-guided optimization

This setting enables dynamic (tiered) profile-guided optimization (PGO) in .NET 6 and later versions.

Setting name Values
Environment variable DOTNET_TieredPGO 1 - enabled0 - disabled
MSBuild property TieredPGO true - enabledfalse - disabled

Profile-guided optimization (PGO) is where the JIT compiler generates optimized code in terms of the types and code paths that are most frequently used. Dynamic PGO works hand-in-hand with tiered compilation to further optimize code based on additional instrumentation that's put in place during tier 0.

Examples

Project file:

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

  <PropertyGroup>
    <TieredPGO>true</TieredPGO>
  </PropertyGroup>

</Project>