Class NuGetPackageManager
Implements
Inherited Members
Namespace: LemonEdge.NuGetManager.Packages
Assembly: LemonEdge.NuGetManager.dll
Syntax
public class NuGetPackageManager : INuGetPackageManager
Constructors
NuGetPackageManager(INuGetExtractionWrapper, INuGetResourceManager, INuGetConfigManager, INuGetHostContext, INuGetRepositoryManager, INuGetVersionManager, IOptions<NuGetSettings>, ILogger<NuGetPackageManager>)
Declaration
public NuGetPackageManager(INuGetExtractionWrapper nuGetExtractionWrapper, INuGetResourceManager nuGetResourceManager, INuGetConfigManager nuGetConfigManager, INuGetHostContext nuGetHostContext, INuGetRepositoryManager nuGetRepositoryManager, INuGetVersionManager nuGetVersionManager, IOptions<NuGetSettings> nugetSettings, ILogger<NuGetPackageManager> logger)
Parameters
Type | Name | Description |
---|---|---|
INuGetExtractionWrapper | nuGetExtractionWrapper | |
INuGetResourceManager | nuGetResourceManager | |
INuGetConfigManager | nuGetConfigManager | |
INuGetHostContext | nuGetHostContext | |
INuGetRepositoryManager | nuGetRepositoryManager | |
INuGetVersionManager | nuGetVersionManager | |
IOptions<NuGetSettings> | nugetSettings | |
ILogger<NuGetPackageManager> | logger |
Methods
GetPackageDependencyInfo(IEnumerable<PackageIdentity>, CancellationToken)
Gets the dependency info for the given NuGet.Packaging.Core.PackageIdentity collection
Declaration
public Task<List<SourcePackageDependencyInfo>> GetPackageDependencyInfo(IEnumerable<PackageIdentity> packageIdentities, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<PackageIdentity> | packageIdentities | A collection of NuGet.Packaging.Core.PackageIdentity |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<List<SourcePackageDependencyInfo>> | A collection of NuGet package installation paths |
GetPackageIdentitiesAsync(IEnumerable<NuGetPackage>, CancellationToken)
Get a collection of NuGet.Packaging.Core.PackageIdentity for each NuGetPackage in nuGetPackages
Each NuGet.Protocol.Core.Types.SourceRepository in NuGetRepositoryManager.Repositories is queried for all available versions of a given PackageName. The best version is then determined from the Versionand a NuGet.Packaging.Core.PackageIdentity is created.
Declaration
public Task<List<PackageIdentity>> GetPackageIdentitiesAsync(IEnumerable<NuGetPackage> nuGetPackages, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<NuGetPackage> | nuGetPackages | A collection of NuGetPackage |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<List<PackageIdentity>> | A collection of NuGet.Packaging.Core.PackageIdentity |
GetPackageIdentity(string, NuGetVersion)
Builds a package identity from a package name and NuGet.Versioning.NuGetVersion
Declaration
public PackageIdentity GetPackageIdentity(string packageName, NuGetVersion version)
Parameters
Type | Name | Description |
---|---|---|
string | packageName | The package name |
NuGetVersion | version | The NuGet.Versioning.NuGetVersion |
Returns
Type | Description |
---|---|
PackageIdentity | A NuGet.Packaging.Core.PackageIdentity |
InstallDependencies(IEnumerable<SourcePackageDependencyInfo>, CancellationToken)
Installs all dependencies in dependenciesToInstall
If a package is not found locally, the package and all of its dependencies will be downloaded from a NuGet.Protocol.Core.Types.SourceRepository and installed. NuGet package dependency resolution is handled using a NuGet.Resolver.PackageResolverContext and NuGet.Resolver.PackageResolver
Declaration
public Task<Dictionary<string, string>> InstallDependencies(IEnumerable<SourcePackageDependencyInfo> dependenciesToInstall, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SourcePackageDependencyInfo> | dependenciesToInstall | A collection of NuGet.Protocol.Core.Types.SourcePackageDependencyInfo |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<Dictionary<string, string>> | A collection of NuGet package installation paths |
SearchPackagesAsync(string, string)
Searches the package sources for those matching the given filter, excluding any unwanted feeds, returning up to 10 results.
Declaration
public Task<IEnumerable<IPackageSearchMetadata>> SearchPackagesAsync(string filter = "", string excludedFeeds = "NuGet")
Parameters
Type | Name | Description |
---|---|---|
string | filter | The filter string. |
string | excludedFeeds | The comma-separated list of excluded feeds. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IPackageSearchMetadata>> | The result set of (maximum 10) NuGet.Protocol.Core.Types.IPackageSearchMetadata. |