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
| Constructor | Summary |
|---|---|
DotnetInfo |
DotnetInfo(minversion, architecture, runtimeType)
public DotnetInfo(Version minversion, RuntimeCpu architecture, Runtimes.DotnetRuntimeType runtimeType = DotnetRuntimeType.WindowsDesktop)
Parameters
| Name | Type | Description |
|---|---|---|
minversion | Version | |
architecture | RuntimeCpu | |
runtimeType | Runtimes.DotnetRuntimeType |
Properties
| Property | Summary |
|---|---|
Id | The unique Id of this runtime. Can be used to retrieve a runtime instance with GetRuntimeByName(string) |
DisplayName | The human-friendly name of this runtime - for displaying to users |
MinVersion | The minimum compatible version that must be installed. |
CpuArchitecture | The CPU architecture of the runtime. This must match the RID of the app being deployed. |
RuntimeType | The 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
| Method | Summary |
|---|---|
CheckIsInstalled | Check if a runtime compatible with the current instance is installed on this system |
CheckIsSupported | Check if this runtime is supported on the current system |
GetDownloadUrl | Retrieves the web url to the latest compatible runtime installer exe |
Parse | Parses a string such as 'net6' or net5.0.14-x86 into a DotnetInfo class capable of checking |
TryParse | Parses a string such as 'net6' or net5.0.14-x86 into a DotnetInfo class capable of checking |
ParseVersion | Safely converts a version string into a version structure, and provides some validation for invalid/unsupported versions. |
TrimVersion | Converts a version structure into the shortest string possible, by trimming trailing zeros. |
GetLatestDotNetVersion | Get latest available version of dotnet. Channel can be 'LTS', 'current', or a two part version |
GetDotNetDownloadUrl | Get 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
| Name | Type | Description |
|---|---|---|
input | string |
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
| Name | Type | Description |
|---|---|---|
input | string | |
info | Runtimes.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
| Name | Type | Description |
|---|---|---|
input | string |
Returns Version
TrimVersion(ver)
protected static string TrimVersion(Version ver)
Converts a version structure into the shortest string possible, by trimming trailing zeros.
Parameters
| Name | Type | Description |
|---|---|---|
ver | Version |
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
| Name | Type | Description |
|---|---|---|
runtimeType | Runtimes.DotnetRuntimeType | |
channel | string | |
downloader | IFileDownloader |
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
| Name | Type | Description |
|---|---|---|
runtimeType | Runtimes.DotnetRuntimeType | |
version | string | |
cpuarch | string |
Returns string
Generated from Velopack 1.1.1