Saltar al contenido principal

Runtimes.DotnetInfo class

Namespace: Velopack.Windows

Represents a modern DOTNET runtime where versions are deployed independenly of the operating system

public class Runtimes.DotnetInfo : Runtimes.RuntimeInfo

Inherits: Runtimes.RuntimeInfo

Constructors

ConstructorSummary
DotnetInfo

DotnetInfo(minversion, architecture, runtimeType)

public DotnetInfo(Version minversion, RuntimeCpu architecture, Runtimes.DotnetRuntimeType runtimeType = DotnetRuntimeType.WindowsDesktop)

Parameters

NameTypeDescription
minversionVersion
architectureRuntimeCpu
runtimeTypeRuntimes.DotnetRuntimeType

Properties

PropertySummary
IdThe unique Id of this runtime. Can be used to retrieve a runtime instance with GetRuntimeByName(string)
DisplayNameThe human-friendly name of this runtime - for displaying to users
MinVersionThe minimum compatible version that must be installed.
CpuArchitectureThe CPU architecture of the runtime. This must match the RID of the app being deployed.
RuntimeTypeThe type of runtime required, eg. Windows Desktop, AspNetCore, Sdk.

Id

public override string Id { get; }

The unique Id of this runtime. Can be used to retrieve a runtime instance with GetRuntimeByName(string)

DisplayName

public override string DisplayName { get; }

The human-friendly name of this runtime - for displaying to users

MinVersion

public Version MinVersion { get; }

The minimum compatible version that must be installed.

CpuArchitecture

public RuntimeCpu CpuArchitecture { get; }

The CPU architecture of the runtime. This must match the RID of the app being deployed. For example, if the app was deployed with 'win-x64', this must be X64 also.

RuntimeType

public Runtimes.DotnetRuntimeType RuntimeType { get; }

The type of runtime required, eg. Windows Desktop, AspNetCore, Sdk.

Methods

MethodSummary
CheckIsInstalledCheck if a runtime compatible with the current instance is installed on this system
CheckIsSupportedCheck if this runtime is supported on the current system
GetDownloadUrlRetrieves the web url to the latest compatible runtime installer exe
ParseParses a string such as 'net6' or net5.0.14-x86 into a DotnetInfo class capable of checking
TryParseParses a string such as 'net6' or net5.0.14-x86 into a DotnetInfo class capable of checking
ParseVersionSafely converts a version string into a version structure, and provides some validation for invalid/unsupported versions.
TrimVersionConverts a version structure into the shortest string possible, by trimming trailing zeros.
GetLatestDotNetVersionGet latest available version of dotnet. Channel can be 'LTS', 'current', or a two part version
GetDotNetDownloadUrlGet download url for a specific version of dotnet. Version must be an absolute version, such as one

CheckIsInstalled()

public override Task<bool> CheckIsInstalled()

Check if a runtime compatible with the current instance is installed on this system

Returns Task<bool>

CheckIsSupported()

public override Task<bool> CheckIsSupported()

Check if this runtime is supported on the current system

Returns Task<bool>

GetDownloadUrl()

public override Task<string> GetDownloadUrl()

Retrieves the web url to the latest compatible runtime installer exe

Returns Task<string>

Parse(input)

public static Runtimes.DotnetInfo Parse(string input)

Parses a string such as 'net6' or net5.0.14-x86 into a DotnetInfo class capable of checking the current system for installed status, or downloading / installing.

Parameters

NameTypeDescription
inputstring

Returns Runtimes.DotnetInfo

TryParse(input, info)

public static bool TryParse(string input, out Runtimes.DotnetInfo info)

Parses a string such as 'net6' or net5.0.14-x86 into a DotnetInfo class capable of checking the current system for installed status, or downloading / installing.

Parameters

NameTypeDescription
inputstring
infoRuntimes.DotnetInfo

Returns bool

ParseVersion(input)

protected static Version ParseVersion(string input)

Safely converts a version string into a version structure, and provides some validation for invalid/unsupported versions.

Parameters

NameTypeDescription
inputstring

Returns Version

TrimVersion(ver)

protected static string TrimVersion(Version ver)

Converts a version structure into the shortest string possible, by trimming trailing zeros.

Parameters

NameTypeDescription
verVersion

Returns string

GetLatestDotNetVersion(runtimeType, channel, downloader)

public static Task<string> GetLatestDotNetVersion(Runtimes.DotnetRuntimeType runtimeType, string channel, IFileDownloader downloader = null)

Get latest available version of dotnet. Channel can be 'LTS', 'current', or a two part version (eg. '6.0') to get the latest minor release.

Parameters

NameTypeDescription
runtimeTypeRuntimes.DotnetRuntimeType
channelstring
downloaderIFileDownloader

Returns Task<string>

GetDotNetDownloadUrl(runtimeType, version, cpuarch)

public static string GetDotNetDownloadUrl(Runtimes.DotnetRuntimeType runtimeType, string version, string cpuarch)

Get download url for a specific version of dotnet. Version must be an absolute version, such as one returned by GetLatestDotNetVersion. cpuarch should be either 'x86', 'x64', or 'arm64'.

Parameters

NameTypeDescription
runtimeTypeRuntimes.DotnetRuntimeType
versionstring
cpuarchstring

Returns string


Generated from Velopack 1.1.1