Skip to content

Instantly share code, notes, and snippets.

@natemcmaster
Last active April 2, 2024 18:27
Show Gist options
  • Save natemcmaster/0bdee16450f8ec1823f2c11af880ceeb to your computer and use it in GitHub Desktop.
Save natemcmaster/0bdee16450f8ec1823f2c11af880ceeb to your computer and use it in GitHub Desktop.
runtimeconfig.json schema

This defines the schema for .NET Core's runtimeconfig.json file.

Usage in an editor

Using Visual Studio, you can get auto-completion if you import the schema in your .JSON file like this:

{
  "$schema": "https://gist.githubusercontent.com/natemcmaster/0bdee16450f8ec1823f2c11af880ceeb/raw/runtimeconfig.template.schema.json"
}

Use these links based on your file type:

{
"$schema": "http://json-schema.org/draft-07/hyper-schema",
"title": ".NET Core RuntimeConfig schema",
"type": "object",
"additionalProperties": false,
"required": [
"runtimeOptions"
],
"properties": {
"$schema": {
"type": "string"
},
"runtimeOptions": {
"$ref": "https://gist.githubusercontent.com/natemcmaster/0bdee16450f8ec1823f2c11af880ceeb/raw/runtimeconfig.template.schema.json",
"description": ".NET Core runtime options"
}
}
}
{
"$schema": "http://json-schema.org/draft-07/hyper-schema",
"title": ".NET Core RuntimeConfig schema",
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string"
},
"configProperties": {
"$ref": "#/definitions/configProperties"
},
"tfm": {
"$ref": "#/definitions/tfm"
},
"applyPatches": {
"$ref": "#/definitions/applyPatches"
},
"rollForwardOnNoCandidateFx": {
"$ref": "#/definitions/rollForwardOnNoCandidateFx"
},
"additionalProbingPaths": {
"$ref": "#/definitions/additionalProbingPaths"
},
"framework": {
"$ref": "#/definitions/framework"
},
"frameworks": {
"type": "array",
"description": "A list of the shared frameworks this application depends on.",
"items": {
"$ref": "#/definitions/framework"
}
}
},
"definitions": {
"tfm": {
"type": "string",
"description": "The short target framework moniker used to compile the application. Example: netcoreapp2.1",
"pattern": "netcoreapp\\d\\.\\d"
},
"applyPatches": {
"type": "boolean",
"description": "Shared framework lookup should find the highest patch version. See also https://github.com/dotnet/core-setup/blob/master/Documentation/design-docs/roll-forward-on-no-candidate-fx.md.",
"default": true
},
"rollForwardOnNoCandidateFx": {
"type": "integer",
"description": "Defines the rollforward policy for loading shared frameworks.",
"default": 1,
"enum": [
0,
1,
2
]
},
"additionalProbingPaths": {
"type": "array",
"description": "Additional directories which can be used to load assemblies and native dependencies. This directory may be a package cache.",
"items": {
"type": "string"
}
},
"framework": {
"type": "object",
"description": "A shared framework which this application depends on.",
"required": [
"name",
"version"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the shared framework",
"examples": [
"Microsoft.NETCore.App",
"Microsoft.AspNetCore.App",
"Microsoft.WindowsDesktop.App",
"Microsoft.AspNetCore.All"
]
},
"version": {
"type": "string",
"description": "The minimum version of the shared framework that can be used.",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"
}
}
},
"configProperties": {
"type": "object",
"description": "Settings which control .NET. See also https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/clr-configuration-knobs.md",
"additionalProperties": {
"type": [
"boolean",
"integer",
"string",
"number"
]
},
"properties": {
"System.GC.Server": {
"type": "boolean",
"description": "Enable server garbage collection"
},
"System.GC.Concurrent": {
"type": "boolean",
"description": "Enable concurrent garbage collection"
},
"System.GC.RetainVM": {
"type": "boolean",
"description": "Put segments that should be deleted on a standby list for future use instead of releasing them back to the OS"
},
"System.Runtime.TieredCompilation": {
"type": "boolean",
"description": "Enable tiered compilation"
},
"System.Threading.ThreadPool.MinThreads": {
"type": "integer",
"minimum": 1,
"description": "Override MinThreads for the ThreadPool worker pool."
},
"System.Threading.ThreadPool.MaxThreads": {
"type": "integer",
"minimum": 1,
"description": "Override MaxThreads for the ThreadPool worker pool."
},
"System.Globalization.Invariant": {
"type": "boolean",
"default": false,
"description": "Enabling invariant mode disables globalization behavior. See also https://github.com/dotnet/corefx/blob/master/Documentation/architecture/globalization-invariant-mode.md."
}
}
}
}
}
@Lordfirespeed
Copy link

Hey - due to additionalProperties: false, the $schema property is technically disallowed (as reported by JetBrains IDEs)!

See this issue for a long debate about that. 😂

Please could you add $schema as an optional property?

@natemcmaster
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment