Table of Contents

Struct DotNetRuntimeInfo

Namespace
AsmResolver.DotNet
Assembly
AsmResolver.DotNet.dll

Provides information about a target runtime.

public readonly struct DotNetRuntimeInfo : IEquatable<DotNetRuntimeInfo>
Implements
Inherited Members

Constructors

DotNetRuntimeInfo(string, Version)

Creates a new instance of the DotNetRuntimeInfo structure.

public DotNetRuntimeInfo(string name, Version version)

Parameters

name string

The name of the runtime.

version Version

The version of the runtime.

Fields

NetCoreApp

The target framework name used by applications targeting .NET and .NET Core.

public const string NetCoreApp = ".NETCoreApp"

Field Value

string

NetFramework

The target framework name used by applications targeting legacy .NET Framework.

public const string NetFramework = ".NETFramework"

Field Value

string

NetStandard

The target framework name used by libraries targeting .NET Standard.

public const string NetStandard = ".NETStandard"

Field Value

string

Properties

IsNetCoreApp

Gets a value indicating whether the application targets the .NET or .NET Core runtime or not.

public bool IsNetCoreApp { get; }

Property Value

bool

IsNetFramework

Gets a value indicating whether the application targets the .NET Framework runtime or not.

public bool IsNetFramework { get; }

Property Value

bool

IsNetStandard

Gets a value indicating whether the application targets the .NET standard specification or not.

public bool IsNetStandard { get; }

Property Value

bool

Name

Gets the name of the runtime.

public string Name { get; }

Property Value

string

Version

Gets the version of the runtime.

public Version Version { get; }

Property Value

Version

Methods

Equals(DotNetRuntimeInfo)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(DotNetRuntimeInfo other)

Parameters

other DotNetRuntimeInfo

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetDefaultCorLib()

Obtains a reference to the default core lib reference of this runtime.

public AssemblyReference GetDefaultCorLib()

Returns

AssemblyReference

The reference to the default core lib.

Exceptions

ArgumentException

The runtime information is invalid or unsupported.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Parse(string)

Parses the framework name as provided in a System.Runtime.Versioning.TargetFrameworkAttribute attribute.

public static DotNetRuntimeInfo Parse(string frameworkName)

Parameters

frameworkName string

The full runtime name.

Returns

DotNetRuntimeInfo

The parsed version info.

ParseMoniker(string)

Parses the target framework moniker as provided in a .runtimeconfig.json file.

public static DotNetRuntimeInfo ParseMoniker(string moniker)

Parameters

moniker string

The moniker

Returns

DotNetRuntimeInfo

The parsed version info.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

TryParse(string, out DotNetRuntimeInfo)

Attempts to parse the framework name as provided in a System.Runtime.Versioning.TargetFrameworkAttribute attribute.

public static bool TryParse(string frameworkName, out DotNetRuntimeInfo info)

Parameters

frameworkName string

The full runtime name.

info DotNetRuntimeInfo

The parsed version info.

Returns

bool

true if the provided name was in the correct format, false otherwise.

TryParseMoniker(string, out DotNetRuntimeInfo)

Attempts to parse the target framework moniker as provided in a .runtimeconfig.json file.

public static bool TryParseMoniker(string moniker, out DotNetRuntimeInfo info)

Parameters

moniker string

The moniker

info DotNetRuntimeInfo

The parsed version info.

Returns

bool

true if the provided name was in the correct format, false otherwise.