小编Lux*_*aes的帖子

如何使用NuGet v3 API下载和解压缩软件包

我一直在使用NuGet.Core包中的以下代码,我在http://blog.nuget.org/20130520/Play-with-packages.html上找到了该代码.

//ID of the package to be looked up
string packageID = "EntityFramework";

//Connect to the official package repository
IPackageRepository repo = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2");

//Initialize the package manager string path = <PATH_TO_WHERE_THE_PACKAGES_SHOULD_BE_INSTALLED>
PackageManager packageManager = new PackageManager(repo, path);

//Download and unzip the package
packageManager.InstallPackage(packageID, SemanticVersion.Parse("5.0.0"));
Run Code Online (Sandbox Code Playgroud)

这非常有效,但我必须将框架更新为.NET Core,而NuGet.Core包不支持.我认为NuGet.Protocol.Core.v3包应该有我需要的东西,但是我找不到办法.我在http://daveaglick.com/posts/exploring-the-nuget-v3-libraries-part-1上找到了大量关于NuGet v3 API的信息.

所以我的问题是:如何使用NuGet v3以编程方式下载和解压缩包?

c# nuget .net-core

5
推荐指数
1
解决办法
1327
查看次数

标签 统计

.net-core ×1

c# ×1

nuget ×1