NugetExtensions
NuGET extensions.
方法
public static HttpClient CreatePrivateHttp(string apiKey)
result = NugetExtensions.CreatePrivateHttp(apiKey)
Create a private HTTP client.
- apiKey
- The API key.
返回值: The private HTTP client.
public static void DisableNugetConfig()
NugetExtensions.DisableNugetConfig()
Disable access to the nuget.config file.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
public static string[] GetTargetFrameworks(PackageArchiveReader reader)
result = NugetExtensions.GetTargetFrameworks(reader)
Get the target frameworks for the package.
- reader
- PackageArchiveReader
返回值: Target frameworks.
public static NuGetVersion Increment(NuGetVersion version)
result = NugetExtensions.Increment(version)
Increment the version.
- version
- NuGetVersion
返回值: The incremented version.
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.
public static NuGetFramework RemovePlatformVersion(NuGetFramework fwk)
result = NugetExtensions.RemovePlatformVersion(fwk)
Remove the platform version.
- fwk
- NuGetFramework
返回值: The framework without the platform version.
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.
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.