NuGetPackageValidationContext Class

Provides context information and methods for validating a NuGet package.

public sealed class NuGetPackageValidationContext : IDisposable
Implements

Properties

NameDescription
CancellationTokenGets the cancellation token for the validation operation.
PackageGets the package reader for accessing the contents of the NuGet package.
PackagePathGets the path to the NuGet package being validated.
SymbolPackageGets the package reader for the symbol package (.snupkg) if it exists alongside the main package.
SymbolServersGets the collection of symbol server URLs configured for checking symbol availability.

Gets the cancellation token for the validation operation.

public CancellationToken CancellationToken { get; }

Property value

CancellationToken

Gets the package reader for accessing the contents of the NuGet package.

public PackageReaderBase Package { get; }

Property value

PackageReaderBase

Gets the path to the NuGet package being validated.

public FullPath PackagePath { get; }

Property value

FullPath

Gets the package reader for the symbol package (.snupkg) if it exists alongside the main package.

public PackageReaderBase? SymbolPackage { get; }

Property value

PackageReaderBase?

Gets the collection of symbol server URLs configured for checking symbol availability.

public IEnumerable<Uri> SymbolServers { get; }

Property value

IEnumerable<Uri>

Methods

NameDescription
Dispose()
IsRuleExcluded(int)Determines whether a specific validation rule is excluded from validation.
ReportError(int, string, string?, string?)Reports a validation error found during package validation.
public void Dispose()

No documentation is available.

Determines whether a specific validation rule is excluded from validation.

public bool IsRuleExcluded(int ruleId)

Parameters

ruleId int
The error code of the rule to check.

Returns

bool true if the rule is excluded; otherwise, false.

ReportError(int, string, string?, string?)

NuGetPackageValidationContext.cs

Reports a validation error found during package validation.

public void ReportError(int errorCode, string message, string? helpText = null, string? fileName = null)

Parameters

errorCode int
The numeric error code identifying the type of validation error.
message string
A human-readable message describing the validation error.
helpText string?
Optional help text providing guidance on how to fix the error.
fileName string?
Optional file name within the package where the error was found.