NugetExtensions

Ecng.Nuget

NuGET extensions.

Методы

CreatePrivateHttp
public static HttpClient CreatePrivateHttp(string apiKey)
result = NugetExtensions.CreatePrivateHttp(apiKey)

Create a private HTTP client.

apiKey
The API key.

Возвращает: The private HTTP client.

DisableNugetConfig
public static void DisableNugetConfig()
NugetExtensions.DisableNugetConfig()

Disable access to the nuget.config file.

GetAllVersionsOrderedAsync
public static Task<NuGetVersion[]> GetAllVersionsOrderedAsync(SourceRepository repo, string packageId, ILogger logger, SourceCacheContext cache, CancellationToken token)
result = NugetExtensions.GetAllVersionsOrderedAsync(repo, packageId, logger, cache, token)

Get all versions.

repo
SourceRepository
packageId
The package ID.
logger
ILogger
cache
SourceCacheContext
token
CancellationToken

Возвращает: All versions ordered.

GetBaseUrl
public static Task<Uri> GetBaseUrl(SourceRepository repo, CancellationToken cancellationToken)
result = NugetExtensions.GetBaseUrl(repo, cancellationToken)

Get the base URL for the repository.

repo
SourceRepository
cancellationToken
CancellationToken

Возвращает: The base URL for the repository.

GetFeedMetadataAsync
public static Task<IPackageSearchMetadata[]> GetFeedMetadataAsync(HttpClient http, Uri registrationsUrl, string packageId, CancellationToken cancellationToken)
result = NugetExtensions.GetFeedMetadataAsync(http, registrationsUrl, packageId, cancellationToken)

What a feed says about every version of a package, read from its registration index -- see CancellationToken).

http
HttpClient
registrationsUrl
The registrations URL for the repository.
packageId
The package ID.
cancellationToken
CancellationToken

Возвращает: The versions, or empty when the feed does not carry the package.

GetFeedMetadataAsync
public static Task<IPackageSearchMetadata[]> GetFeedMetadataAsync(SourceRepository repo, HttpClient http, string packageId, CancellationToken cancellationToken)
result = NugetExtensions.GetFeedMetadataAsync(repo, http, packageId, cancellationToken)

What a feed says about every version of a package -- when it was published, whether it is listed, and what it depends on for each target framework -- oldest first. Unlisted versions are included.

repo
SourceRepository
http
HttpClient
packageId
The package ID.
cancellationToken
CancellationToken

Возвращает: The versions, or empty when the feed does not carry the package.

GetFeedVersionsAsync
public static Task<NuGetVersion[]> GetFeedVersionsAsync(SourceRepository repo, HttpClient http, string packageId, CancellationToken cancellationToken)
result = NugetExtensions.GetFeedVersionsAsync(repo, http, packageId, cancellationToken)

The versions a feed holds for a package right now, oldest first.

repo
SourceRepository
http
HttpClient
packageId
The package ID.
cancellationToken
CancellationToken

Возвращает: The versions, or empty when the feed does not carry the package.

GetLastVersionAsync
public static Task<NuGetVersion> GetLastVersionAsync(SourceRepository repo, string packageId, bool allowPreview, ILogger logger, SourceCacheContext cache, CancellationToken token)
result = NugetExtensions.GetLastVersionAsync(repo, packageId, allowPreview, logger, cache, token)

Get the last version.

repo
SourceRepository
packageId
The package ID.
allowPreview
Allow preview versions.
logger
ILogger
cache
SourceCacheContext
token
CancellationToken

Возвращает: The last version.

GetLastVersionInFloatingRangeAsync
public static Task<NuGetVersion> GetLastVersionInFloatingRangeAsync(SourceRepository repo, string packageId, string floatingVer, ILogger logger, SourceCacheContext cache, CancellationToken token)
result = NugetExtensions.GetLastVersionInFloatingRangeAsync(repo, packageId, floatingVer, logger, cache, token)

Get the last version in the floating range.

repo
SourceRepository
packageId
The package ID.
floatingVer
The floating version.
logger
ILogger
cache
SourceCacheContext
token
CancellationToken

Возвращает: The last version in the floating range.

GetNuspecAsync
public static Task<Stream> GetNuspecAsync(HttpClient http, Uri baseUrl, string packageId, NuGetVersion version, CancellationToken cancellationToken)
result = NugetExtensions.GetNuspecAsync(http, baseUrl, packageId, version, cancellationToken)

Get the nuspec file.

http
HttpClient
baseUrl
The base URL for the repository.
packageId
The package ID.
version
The package version.
cancellationToken
The cancellation token.

Возвращает: The nuspec file.

GetRegistrationsUrl
public static Task<Uri> GetRegistrationsUrl(SourceRepository repo, CancellationToken cancellationToken)
result = NugetExtensions.GetRegistrationsUrl(repo, cancellationToken)

Get the registrations URL for the repository: where the feed describes each version of a package.

repo
SourceRepository
cancellationToken
CancellationToken

Возвращает: The registrations URL for the repository.

GetSearchUrl
public static Task<Uri> GetSearchUrl(SourceRepository repo, CancellationToken cancellationToken)
result = NugetExtensions.GetSearchUrl(repo, cancellationToken)

Get the search URL for the repository.

repo
SourceRepository
cancellationToken
CancellationToken

Возвращает: The search URL for the repository.

GetTargetFrameworks
public static string[] GetTargetFrameworks(PackageArchiveReader reader)
result = NugetExtensions.GetTargetFrameworks(reader)

Get the target frameworks for the package.

reader
PackageArchiveReader

Возвращает: Target frameworks.

Increment
public static NuGetVersion Increment(NuGetVersion version)
result = NugetExtensions.Increment(version)

Increment the version.

version
NuGetVersion

Возвращает: The incremented version.

ParseFeedVersions
public static NuGetVersion[] ParseFeedVersions(string json)
result = NugetExtensions.ParseFeedVersions(json)

The versions listed in a flat container index, oldest first. An entry that cannot be read is skipped rather than throwing the rest of the list away.

json
The index.

Возвращает: The versions.

RemovePlatformVersion
public static NuGetFramework RemovePlatformVersion(NuGetFramework fwk)
result = NugetExtensions.RemovePlatformVersion(fwk)

Remove the platform version.

fwk
NuGetFramework

Возвращает: The framework without the platform version.

SearchAllAsync
public static Task<IPackageSearchMetadata[]> SearchAllAsync(SourceRepository repo, string query, bool allowPreview, ILogger logger, CancellationToken cancellationToken)
result = NugetExtensions.SearchAllAsync(repo, query, allowPreview, logger, cancellationToken)

Everything a feed answers to a search query, page by page.

repo
SourceRepository
query
The query, in the feed's own syntax (for example author:someone).
allowPreview
Allow preview versions.
logger
ILogger
cancellationToken
CancellationToken

Возвращает: The packages found, each carrying its latest version and download count.

WithSuffix
public static NuGetVersion WithSuffix(NuGetVersion version, string suffix)
result = NugetExtensions.WithSuffix(version, suffix)

Add a suffix to the version.

version
NuGetVersion
suffix
The suffix to add.

Возвращает: The version with the suffix.