-
Notifications
You must be signed in to change notification settings - Fork 258
[Spec] Package download API
Zhi Li edited this page Sep 28, 2017
·
13 revisions
Status: Incubation
Msbuild SDK Resolver need an API From NuGet which can download nuget package to .nuget folder by passing package Id and version.
The goal of this API is to provider a high level interface (supports cross-platform) to download nuget package directly and return the package path.
- It will be some static utility methods in project NuGet.Commands or new Project
// Download the package
public static async Task<string> DownloadPackageAsync(string packageId,
string versionRange,
string initialConfigDirectory,
ILogger log);
public static async Task<string> DownloadPackageAsync(string packageId,
string versionRange,
string configFile
ILogger log);
// Download the package and all dependency packages
public static async Task<string> DownloadPackageClosureAsync(string packageId,
string versionRange,
string initialConfigDirectory,
string targetFramework
ILogger log);
public static async Task<string> DownloadPackageClosureAsync(string packageId,
string versionRange,
string configFile
string targetFramework
ILogger log);
public static async Task<string> IsPackageInstalled(string packageId, string version);
- Package Id Type: String
- Package Version Range Type: String
- Target Framework Type: String
- NuGet Setting Root Path Type: String
- NuGet Config File Path Type: String
- NoCache
Package path for the package which is passed as parameter
- Package Id
- Package version Range
- NuGet Setting Root
- NuGet Config File Path
- TargetFramework
- Nocahe
- Package installed Path for the package which is passed as parameter
-
How to discover Package source, Package Credential?
This API will use NuGet.Config to get Package Source information
- User pass NuGet.Config file to the API, then it will use this specified NuGet.Config
- If No NuGet.Config passed and Root path is null or empty, it will load NuGet.Config from Appdata and ProgramData
- If No NuGet.Config passed and Root path is not null, it will load every Nuget.Config from Root Path to Driver root and also load NuGet.Config from Appdata and ProgramData.
- How to consume this API?
- Reference NuGet.Commands or a new package which contains this API in their project.
- NuGet provides a msbuild task to call this API. (need a msbuild task spec for this)
-
Does this API ignore failed source?
Yes, this API ignore failed source by default. we might add parameter to override this behavior in the future.
- Does NuGet need to support downloading multiple packages in one call?
- Does NuGet need to provide a way to find all dependency packages after the top package downloaded?
- Do we need a new project for this API?
- what's the return type (string / Boolean / result type)?
- Does this API accept VersionRange Type?
- Should we put this API in a new dll?
Check out the proposals in the accepted
& proposed
folders on the repository, and active PRs for proposals being discussed today.