Table of Contents

Class NuspecUtility

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

Until NuspecReader and Manifest are unified, this is a place to share implementations of reading and parsing specific elements out of the .nuspec XML.

public static class NuspecUtility
Inheritance
NuspecUtility
Inherited Members

Fields

FrameworkReference

public static readonly string FrameworkReference

Field Value

string

FrameworkReferences

public static readonly string FrameworkReferences

Field Value

string

Group

public static readonly string Group

Field Value

string

License

public static readonly string License

Field Value

string

Name

public static readonly string Name

Field Value

string

PackageType

public static readonly string PackageType

Field Value

string

PackageTypes

public static readonly string PackageTypes

Field Value

string

Repository

public static readonly string Repository

Field Value

string

RepositoryBranch

public static readonly string RepositoryBranch

Field Value

string

RepositoryCommit

public static readonly string RepositoryCommit

Field Value

string

RepositoryUrl

public static readonly string RepositoryUrl

Field Value

string

Serviceable

public static readonly string Serviceable

Field Value

string

TargetFramework

public static readonly string TargetFramework

Field Value

string

Type

public static readonly string Type

Field Value

string

Version

public static readonly string Version

Field Value

string

Methods

GetPackageTypes(XElement, bool)

Gets the package types from a .nuspec metadata XML element.

public static IReadOnlyList<PackageType> GetPackageTypes(XElement metadataNode, bool useMetadataNamespace)

Parameters

metadataNode XElement

The metadata XML element.

useMetadataNamespace bool

Whether or not to use the metadata element's namespace when finding the package type nodes. If false is specified, only the local names of the package type nodes are used for comparison. If true is specified, the package type nodes must have the same namespace as the metadata node.

Returns

IReadOnlyList<PackageType>

A list of package types. If no package types are found in the metadata node, an empty list is returned.

IsServiceable(XElement)

Gets the value of serviceable element from a .nuspec metadata XML element.

public static bool IsServiceable(XElement metadataNode)

Parameters

metadataNode XElement

The metadata XML element.

Returns

bool

true if the serviceable element is set in the .nuspec file as true, else false.