且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在.NET Core中以编程方式从nuget下载nupkg软件包?

更新时间:2022-05-03 04:31:34

您显示的代码示例使用了.NET Core不支持的NuGet 2.您将需要使用NuGet 3或即将发布的NuGet4.这些API与NuGet 2相比是一个巨大的突破.这些突破性的变化之一是

The code sample you have shown uses NuGet 2 which is not supported on .NET Core. You'll need to use NuGet 3 or the (soon to be released) NuGet 4. These APIs are a huge break from NuGet 2. One of these breaking changes is that NuGet.Core is obsolete on won't be ported to .NET Core.

在docs.microsoft上结帐 NuGet API v3 .com获取有关NuGet 3的信息.在撰写本文时,此文档基本上是一个很大的TODO,并且没有太多信息.

Checkout NuGet API v3 on docs.microsoft.com for info on NuGet 3. At the time of writing, this doc is basically a big TODO and doesn't have much info.

以下是一些更有用的博客文章.

Here are some blog posts that are more useful.

探索NuGet v3库,第1部分 简介和概念

Exploring the NuGet v3 Libraries, Part 1 Introduction and concepts

探索NuGet v3库,第2部分

探索NuGet v3库,第3部分

当然,您始终可以通过NuGet的源代码进行摸索,以查找更多示例.大多数核心逻辑都存在于 https://github.com/nuget/nuget.client 中.

And of course, you can always go spelunking through NuGet's source code to find more examples. Most of the core logic lives in https://github.com/nuget/nuget.client.