Table of Contents

Class NuGetLicenseExpression

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

Represents a parsed NuGetLicenseExpression. This is an abstract class so based on the Type, it can be either a NuGetLicense or a LicenseOperator. LicenseExpressionType

public abstract class NuGetLicenseExpression
Inheritance
NuGetLicenseExpression
Derived
Inherited Members
Extension Methods

Constructors

NuGetLicenseExpression()

protected NuGetLicenseExpression()

Properties

Type

The type of the NuGetLicenseExpression. License type means that it's a NuGetLicense. Operator means that it's a LicenseOperator

public LicenseExpressionType Type { get; protected set; }

Property Value

LicenseExpressionType

Methods

Parse(string)

Parses a License Expression if valid. The expression would be parsed correct, even if non-standard exceptions are encountered. The non-standard Licenses/Exceptions have metadata on them with which the caller can make decisions.

public static NuGetLicenseExpression Parse(string expression)

Parameters

expression string

The expression to be parsed.

Returns

NuGetLicenseExpression

Parsed NuGet License Expression model.

Exceptions

NuGetLicenseExpressionParsingException

If the expression is empty or null.

NuGetLicenseExpressionParsingException

If the expression has invalid characters

NuGetLicenseExpressionParsingException

If the expression itself is invalid. Example: MIT OR OR Apache-2.0, or the MIT or Apache-2.0, because the expressions are case sensitive.

NuGetLicenseExpressionParsingException

If the expression's brackets are mismatched.

NuGetLicenseExpressionParsingException

If the licenseIdentifier is deprecated.

NuGetLicenseExpressionParsingException

If the exception identifier is deprecated.