Table of Contents

Class LicenseMetadata

Namespace
NuGet.Packaging
Assembly
Chocolatey.NuGet.Packaging.dll

Represents the Package LicenseMetadata details. All the relevant warnings and errors should parsed into this model and ideally the readers of this metadata never throw.

public class LicenseMetadata : IEquatable<LicenseMetadata>
Inheritance
LicenseMetadata
Implements
Inherited Members

Constructors

LicenseMetadata(LicenseType, string, NuGetLicenseExpression, IReadOnlyList<string>, Version)

public LicenseMetadata(LicenseType type, string license, NuGetLicenseExpression expression, IReadOnlyList<string> warningsAndErrors, Version version)

Parameters

type LicenseType
license string
expression NuGetLicenseExpression
warningsAndErrors IReadOnlyList<string>
version Version

Fields

CurrentVersion

public static readonly Version CurrentVersion

Field Value

Version

EmptyVersion

public static readonly Version EmptyVersion

Field Value

Version

LicenseFileDeprecationUrl

public static readonly Uri LicenseFileDeprecationUrl

Field Value

Uri

LicenseServiceLinkTemplate

public static readonly string LicenseServiceLinkTemplate

Field Value

string

Properties

License

The license, never null, could be empty.

public string License { get; }

Property Value

string

LicenseExpression

The license expression, could be null if the version is higher than the current supported or if the expression is not parseable.

public NuGetLicenseExpression LicenseExpression { get; }

Property Value

NuGetLicenseExpression

LicenseUrl

public Uri LicenseUrl { get; }

Property Value

Uri

Type

The LicenseType, never null

public LicenseType Type { get; }

Property Value

LicenseType

Version

LicenseMetadata (expression) version. Never null.

public Version Version { get; }

Property Value

Version

WarningsAndErrors

Non-null when the expression parsing yielded some issues. This will be used to display the errors/warnings in the UI. Only populated when the metadata element is returned by the nuspec reader;

public IReadOnlyList<string> WarningsAndErrors { get; }

Property Value

IReadOnlyList<string>

Methods

Equals(LicenseMetadata)

public bool Equals(LicenseMetadata other)

Parameters

other LicenseMetadata

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int