C# 如何下载没有 nuget.exe 或 Visual Studio 扩展的 Nuget 包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14894864/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 13:22:35  来源:igfitidea点击:

How to download a Nuget package without nuget.exe or Visual Studio extension?

c#.netvisual-studionuget

提问by Colonel Panic

How can I download a NuGet package? I don't have the NuGet Visual Studio extension or the command line program nuget.exe. How can I download the .nupack file from the web? As I understand I will be able to extract the .dllfiles from it (with 7-zip) to use as normal.

如何下载 NuGet 包?我没有 NuGet Visual Studio 扩展或命令行程序 nuget.exe。如何从网上下载 .nupack 文件?据我了解,我将能够从中提取.dll文件(使用 7-zip)以正常使用。

The package I happen to be interested in is http://nuget.org/packages/Microsoft.Bcl.Async, but I would like to know how to do this generally.

我碰巧感兴趣的包是http://nuget.org/packages/Microsoft.Bcl.Async,但我想知道一般如何做到这一点。

In the world of Ruby this would be easy - every package page on the RubyGems website has a download link to a .gem file, e.g.: https://rubygems.org/gems/pony

在 Ruby 的世界里,这很容易——RubyGems 网站上的每个包页面都有一个 .gem 文件的下载链接,例如:https://rubygems.org/gems/pony



The argument over NuGet's manifest destiny belongs elsewhere. It doesn't matter to this question why I eschew it. I'm not the only one though.

关于 NuGet 注定命运的争论属于别处。对于这个问题,我为什么回避它并不重要。虽然我不是唯一的

采纳答案by quasoft

Although building the URL or using tools is still possible, it is not needed anymore.

尽管构建 URL 或使用工具仍然是可能的,但不再需要了。

https://www.nuget.org/currently has a download link named "Download package", that is available even if you don't have an account on the site.

https://www.nuget.org/目前有一个名为“下载包”的下载链接,即使您在该站点上没有帐户,也可以使用该链接。

(at the bottom of the right column).

(在右栏的底部)。



Example of EntityFramework's detail page: https://www.nuget.org/packages/EntityFramework/: (Updated after comment of kwitee.)

EntityFramework 的详细信息页面示例:https: //www.nuget.org/packages/EntityFramework/ :(在 kwitee 评论后更新。

Example of EntityFramework's detail page

EntityFramework 的详细信息页面示例

回答by Alex KeySmith

I haven't tried it yet, but it looks like NuGet Package Explorer should be able to do it:

我还没有尝试过,但看起来 NuGet 包资源管理器应该能够做到:

https://github.com/NuGetPackageExplorer/NuGetPackageExplorer

https://github.com/NuGetPackageExplorer/NuGetPackageExplorer

NuGet Package Explorer

NuGet 包资源管理器

(or like Colonel Panic says, 7-zip should probably do it)

(或者像 Panic 上校所说的,7-zip 应该可以做到)

回答by Xavier Decoster

Either make an account on the Nuget.org website, then log in, browse to the package you want and click on the Downloadlink on the left menu.

在 Nuget.org 网站上创建一个帐户,然后登录,浏览到所需的包,然后单击左侧菜单上的下载链接。



Or guess the URL. They have the following format:

或者猜网址。它们具有以下格式:

https://www.nuget.org/api/v2/package/{packageID}/{packageVersion}

Then simply unzip the .nupkg file and extract the contents you need.

然后只需解压缩 .nupkg 文件并提取您需要的内容。

回答by Colonel Panic

Based on Xavier's answer, I wrote a Google chrome extension NuTaketo add links to the Nuget.org package pages.

根据Xavier 的回答,我编写了一个 Google chrome 扩展NuTake来添加指向 Nuget.org 包页面的链接。

回答by WorkSmarter

To obtain the current stable version of the NuGet package use:

要获取 NuGet 包的当前稳定版本,请使用:

https://www.nuget.org/api/v2/package/{packageID}

回答by Mehdi Kashefikia

  1. Go to http://www.nuget.org
  2. Search for desired package. For example: Microsoft.Owin.Host.SystemWeb
  3. Download the package by clicking the Download link on the left.
  4. Do step 3 for the dependencies which are not already installed. Nuget download page
  5. Store all downloaded packages in a custom folder. The default is c:\Package source.
  6. Open Nuget Package Manager in Visual Studio and make sure you have an "Available package source" that points to the specified address in step 5; If not, simply add one by providing a custom name and address. Click OK. Tools->Manage NuGet Packages->Package Manager SettingsNuGet Package Manager Options Window
  7. At this point you should be able to install the package exactly the same way you would install an online package through the interface. You probably won't be able to install the package using NuGet console.
  1. 转到http://www.nuget.org
  2. 搜索所需的包。例如:Microsoft.Owin.Host.SystemWeb
  3. 单击左侧的下载链接下载软件包。
  4. 对尚未安装的依赖项执行第 3 步。 Nuget下载页面
  5. 将所有下载的包存储在自定义文件夹中。默认为 c:\Package source。
  6. 在 Visual Studio 中打开 Nuget 包管理器,并确保您有一个“可用包源”指向步骤 5 中的指定地址;如果没有,只需通过提供自定义名称和地址来添加一个。单击确定。 工具->管理 NuGet 包->包管理器设置NuGet 包管理器选项窗口
  7. 此时,您应该能够以与通过界面安装在线软件包完全相同的方式安装软件包。您可能无法使用 NuGet 控制台安装包。