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
Fields
NetCoreAppName
The target framework name used by applications targeting .NET or .NET Core.
public const string NetCoreAppName = ".NETCoreApp"
Field Value
NetCoreName
A target framework name used in some legacy architectures.
public const string NetCoreName = ".NETCore"
Field Value
Remarks
This should not be confused with NetCoreName, which is the correct name for applications targeting .NET or .NET Core.
NetFrameworkName
The target framework name used by applications targeting legacy .NET Framework.
public const string NetFrameworkName = ".NETFramework"
Field Value
NetPortableName
The target framework name used by applications targeting legacy .NET Portable.
public const string NetPortableName = ".NETPortable"
Field Value
NetStandardName
The target framework name used by libraries targeting .NET Standard.
public const string NetStandardName = ".NETStandard"
Field Value
Properties
IsNetCore
Gets a value indicating whether or not the application is targeting a legacy architecture that uses .NET Core (.NET Native).
public bool IsNetCore { get; }
Property Value
Remarks
This should not be confused with IsNetCoreApp, which is the correct property for whether or not an application is targeting .NET or .NET Core.
IsNetCoreApp
Gets a value indicating whether the application targets the .NET or .NET Core runtime or not.
public bool IsNetCoreApp { get; }
Property Value
IsNetFramework
Gets a value indicating whether the application targets the .NET Framework runtime or not.
public bool IsNetFramework { get; }
Property Value
IsNetPortable
Gets a value indicating whether the application targets the .NET Portable runtime or not.
public bool IsNetPortable { get; }
Property Value
IsNetStandard
Gets a value indicating whether the application targets the .NET standard specification or not.
public bool IsNetStandard { get; }
Property Value
Name
Gets the name of the runtime.
public string Name { get; }
Property Value
Version
Gets the version of the runtime.
public Version Version { get; }
Property Value
Methods
Equals(DotNetRuntimeInfo)
public bool Equals(DotNetRuntimeInfo other)
Parameters
otherDotNetRuntimeInfo
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetAssumedImplCorLib()
Obtains a reference to the assumed implementation core lib for this runtime.
public AssemblyReference? GetAssumedImplCorLib()
Returns
- AssemblyReference
The reference to the assumed implementation core lib.
Exceptions
- ArgumentException
The runtime information is invalid or unsupported.
GetDefaultCorLib()
Obtains a reference to the default core lib 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()
public override int GetHashCode()
Returns
NetCoreApp(int, int)
Constructs a runtime info record referencing .NET Standard.
public static DotNetRuntimeInfo NetCoreApp(int major, int minor)
Parameters
Returns
- DotNetRuntimeInfo
The runtime info record.
NetCoreApp(int, int, int)
Constructs a runtime info record referencing .NET Standard.
public static DotNetRuntimeInfo NetCoreApp(int major, int minor, int patch)
Parameters
Returns
- DotNetRuntimeInfo
The runtime info record.
NetCoreApp(Version)
Constructs a runtime info record referencing .NET Core and .NET.
public static DotNetRuntimeInfo NetCoreApp(Version version)
Parameters
versionVersionThe version
Returns
- DotNetRuntimeInfo
The runtime info record.
NetFramework(int, int)
Constructs a runtime info record referencing legacy .NET Framework.
public static DotNetRuntimeInfo NetFramework(int major, int minor)
Parameters
Returns
- DotNetRuntimeInfo
The runtime info record.
NetFramework(int, int, int)
Constructs a runtime info record referencing legacy .NET Framework.
public static DotNetRuntimeInfo NetFramework(int major, int minor, int patch)
Parameters
Returns
- DotNetRuntimeInfo
The runtime info record.
NetFramework(Version)
Constructs a runtime info record referencing legacy .NET Framework.
public static DotNetRuntimeInfo NetFramework(Version version)
Parameters
versionVersionThe version
Returns
- DotNetRuntimeInfo
The runtime info record.
NetStandard(int, int)
Constructs a runtime info record referencing .NET Standard.
public static DotNetRuntimeInfo NetStandard(int major, int minor)
Parameters
Returns
- DotNetRuntimeInfo
The runtime info record.
NetStandard(Version)
Constructs a runtime info record referencing .NET Standard.
public static DotNetRuntimeInfo NetStandard(Version version)
Parameters
versionVersionThe version
Returns
- DotNetRuntimeInfo
The runtime info record.
Parse(string)
Parses the framework name as provided in a System.Runtime.Versioning.TargetFrameworkAttribute attribute.
public static DotNetRuntimeInfo Parse(string frameworkName)
Parameters
frameworkNamestringThe 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
monikerstringThe moniker
Returns
- DotNetRuntimeInfo
The parsed version info.
ToString()
public override string ToString()
Returns
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
frameworkNamestringThe full runtime name.
infoDotNetRuntimeInfoThe parsed version info.
Returns
- bool
trueif the provided name was in the correct format,falseotherwise.
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
monikerstringThe moniker
infoDotNetRuntimeInfoThe parsed version info.
Returns
- bool
trueif the provided name was in the correct format,falseotherwise.