Class RuntimeConfiguration
- Namespace
- AsmResolver.DotNet.Config.Json
- Assembly
- AsmResolver.DotNet.dll
Represents the root object of a runtime configuration, stored in a *.runtimeconfig.json file.
public class RuntimeConfiguration
- Inheritance
-
RuntimeConfiguration
- Inherited Members
Constructors
RuntimeConfiguration()
Creates a new empty runtime configuration.
public RuntimeConfiguration()
RuntimeConfiguration(RuntimeOptions)
Creates a new runtime configuration with the provided options.
public RuntimeConfiguration(RuntimeOptions options)
Parameters
optionsRuntimeOptions
Properties
RuntimeOptions
Gets or sets the runtime options.
public RuntimeOptions RuntimeOptions { get; set; }
Property Value
Methods
FromFile(string)
Parses runtime configuration from a JSON file.
public static RuntimeConfiguration? FromFile(string path)
Parameters
pathstringThe path to the runtime configuration file.
Returns
- RuntimeConfiguration
The parsed runtime configuration.
FromJson(string)
Parses runtime configuration from a JSON string.
public static RuntimeConfiguration? FromJson(string json)
Parameters
jsonstringThe raw json string configuration file.
Returns
- RuntimeConfiguration
The parsed runtime configuration.
ToJson()
Serializes the configuration to a JSON string.
public string ToJson()
Returns
- string
The JSON string.
TryGetTargetRuntime(out DotNetRuntimeInfo)
Attempts to determine the target runtime based on the contents of the runtime configuration file.
public bool TryGetTargetRuntime(out DotNetRuntimeInfo targetRuntime)
Parameters
targetRuntimeDotNetRuntimeInfoThe target runtime.
Returns
- bool
trueif the runtime was determined successfully,falseotherwise.
Write(string)
Writes the configuration to a file.
public void Write(string path)
Parameters
pathstringThe path to the JSON output file.