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
DotNetRuntimeInfo(string, Version, string?)
Creates a new instance of the DotNetRuntimeInfo structure.
public DotNetRuntimeInfo(string name, Version version, string? profile)
Parameters
namestringThe name of the runtime.
versionVersionThe version of the runtime.
profilestringThe optional target framework profile.
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
SilverlightName
The target framework name used by applications targeting Microsoft Silverlight.
public const string SilverlightName = "Silverlight"
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
IsSilverlight
Gets a value indicating whether the application targets the Microsoft Silverlight runtime or not.
public bool IsSilverlight { get; }
Property Value
Name
Gets the name of the runtime.
public string Name { get; }
Property Value
Profile
Gets the target framework profile, if available.
public string? Profile { get; }
Property Value
Version
Gets the version of the runtime.
public Version Version { get; }
Property Value
Methods
Equals(DotNetRuntimeInfo)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(DotNetRuntimeInfo other)
Parameters
otherDotNetRuntimeInfoAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
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()
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.
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.
Silverlight(int, int)
Constructs a runtime info record referencing Microsoft Silverlight.
public static DotNetRuntimeInfo Silverlight(int major, int minor)
Parameters
Returns
- DotNetRuntimeInfo
The runtime info record.
Silverlight(Version)
Constructs a runtime info record referencing Microsoft Silverlight.
public static DotNetRuntimeInfo Silverlight(Version version)
Parameters
versionVersionThe version
Returns
- DotNetRuntimeInfo
The runtime info record.
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
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.