Nuget 包没有 nuget 包管理器?

发布于 2024-11-02 21:15:21 字数 85 浏览 3 评论 0原文

除了编译的库之外,nuget 包实际上还包含什么?

是否可以在不使用包管理器的情况下下载这些包并在其他地方使用它们?

谢谢!

What does a nuget package actually consist of, apart from the compiled libraries?

Is it possible to download these packages without using the package manager and use them elsewhere?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

陌生 2024-11-09 21:15:21

You can download them from http://packages.nuget.org/api/v1/package/<PACKAGE_YOU_WANT>/ using your browser.

You can get the package name from: http://packages.nuget.org/Packages

Example:
jQuery UI (Combined Library) Package is at: http://packages.nuget.org/packages/jQuery.UI.Combined
To download: http://packages.nuget.org/api/v1/package/jQuery.UI.Combined/

逆光下的微笑 2024-11-09 21:15:21

除了编译的库之外,nuget 包实际上还包含什么?

看看这里。基本上,它是一个扩展名为 .nupkg 的文件,只不过是一个 .zip 文件,其中包含上一个链接中解释的结构和一些 xml 元数据。

是否可以在不使用包管理器的情况下下载这些包并在其他地方使用它们?

当然,只需下载 .nupkg 文件即可。

What does a nuget package actually consist of, apart from the compiled libraries?

Take a look here. Basically it is a file with the .nupkg extension which is nothing more than a .zip file containing the structure explained in the previous link and some xml metadata.

Is it possible to download these packages without using the package manager and use them elsewhere?

Sure, simply download the .nupkg file.

陌伤浅笑 2024-11-09 21:15:21

根据 @Gth685 的回答,我制作了一个 Google Chrome 扩展程序,将下载链接添加到 http://nuget.org

https://chrome.google.com/webstore/detail/nutake/ibhhbcaipjilldjkhhblhgdedjgoecap?hl=en

Based on @Gth685's answer, I made a Google Chrome extension that adds download links to package pages on http://nuget.org

https://chrome.google.com/webstore/detail/nutake/ibhhbcaipjilldjkhhblhgdedjgoecap?hl=en

众所周知,您只需在 nuget.org 上创建一个帐户即可。登录后,左侧工具栏上将显示下载链接,您可以直接下载任何 .nupkg 文件。

Just so everyone knows, you can just create an account on nuget.org. Once logged in a download link will appear on the left toolbar that will allow you to directly download any .nupkg file.

尸血腥色 2024-11-09 21:15:21

补充评论:
下载 *.zip(例如 jquery)后,将结尾从 *.zip 更改为 *.nupkg,然后您可以使用 VS 中的包管理器安装它们。
或许只有我一个人不得不思考这个问题。如果没有,希望有帮助。

Additional comment:
After downloading the *.zip (example jquery) change the ending from *.zip to *.nupkg and then you are able to install them with the Package Manager in VS.
Perhaps it's just me who had to think about it for a while. If not, hope it helps.

月下伊人醉 2024-11-09 21:15:21

抱歉,这应该是一条评论,但我没有足够的代表。

根据这个答案中提到的Chrome扩展程序生成的html,我们可以改进gth685f 的答案指出,要下载不是最新的软件包,URL 是packages.nuget.org/api/v2/package//(还要注意递增的 API 版本号)。

Sorry, this should be a comment, but I don't have enough rep.

Based on the html generated by the Chrome extension mentioned in this answer, we can improve gth685f's answer by noting that, to download packages that are not the latest, the URL is packages.nuget.org/api/v2/package/<PACKAGE_YOU_WANT>/<VERSION_NUMBER> (note the incremented API version number too).

守护在此方 2024-11-09 21:15:21

需要补充的是,V2 api 与 V1 的格式相同,可以使用浏览器下载包。

http://packages.nuget.org/api/v2/package//

Just to add that the V2 api is the same format as V1 to download a package using your browser.

http://packages.nuget.org/api/v2/package//

红焚 2024-11-09 21:15:21

引用 NuGet 可能在某些(大多数?)时间有效,但您也可能会遇到版本控制问题。例如,尝试将 Microsoft HTTP 客户端库 NuGet 包 添加到 .NET 4 项目并检查生成的 csproj 文件。

首先,您会注意到一些 BCL 程序集已被重写:

  1. System.IO.dll
  2. System.Runtime.dll
  3. System.Threading.Tasks

现在所有引用项目也必须使用这些重写 (因为您无法引用同一程序集的多个版本)。除此之外,这意味着您会丢失对这些程序集的更新(除非 BCL NuGet 包也已更新)。

您还会注意到您的 csproj 包含以下条目(如果删除它,它将不起作用):

<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />

我不了解 MSBuild,但我猜测这可能会影响您的构建环境。

Referencing NuGet may work some (most?) of the time, but you may also run into versioning issues. For example, try adding the Microsoft HTTP Client Libraries NuGet package to a .NET 4 project and examine the resulting csproj file.

First, you'll notice that some of the BCL assemblies have been overriden:

  1. System.IO.dll
  2. System.Runtime.dll
  3. System.Threading.Tasks

And now all referencing projects have to use these overrides as well (since you can't reference multiple versions of the same assembly). Among other things, it means you lose updates to those assemblies (unless the BCL NuGet package is updated as well).

You will also notice your csproj contains the following entry (it won't work if you remove it):

<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />

I am not knowledgable about MSBuild, but I'm guessing this could affect your build environment.

剑心龙吟 2024-11-09 21:15:21

您还可以使用命令行工具 nuget.exe 下载 nupkg 文件,如下所示:


nuget安装包Id

获取最新版本,或


nuget install packageId -Version 版本

获取具体版本。

You can also use the command line tool nuget.exe to download the nupkg file, like this:


nuget install packageId

to get the latest version, or


nuget install packageId -Version version

to get the specific version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文