使用“ dotnet添加软件包-s”安装nuget软件包。指定私人github nuget feed时失败

发布于 2025-02-05 14:55:05 字数 752 浏览 1 评论 0原文

我有一个来自github的私人供稿,我将其添加到nuget.config文件:

<add key="github" value="https://nuget.pkg.github.com/..." />

我可以通过使用dotnet nuget list source source (请参阅下面的ScreenShot)来确认其工作。

但是,当运行dotnet添加软件包-s github packagename时,它会失败,“没有版本可用于软件包”错误。删除-s github works(如果它在顶部,则从私有feed安装)。

我可以自己手动运行它(删除-s),但我正在编写一个脚本以安装其他开发人员。即使它不在列表的顶部,我也需要可靠地从私有供稿安装它。 nuget.org在我们的私有feed中使用相同的名称。

为什么用-s指定包源不起作用?我该如何修复?

I have a private feed from GitHub that I added to Nuget.config file:

<add key="github" value="https://nuget.pkg.github.com/..." />

I can confirm it works by using dotnet nuget list source (see screenshot below).

However when running dotnet add package -s github PackageName, it fails with "There are no versions available for the package" error. Removing the -s github works (and it installs from the Private feed if it is on the top).

enter image description here

Although I can manually run it for myself (removing -s), I am writing a script to install it for other developers. I need to reliably install it from the private feed even if it's not on the top of the list. There may be packages in nuget.org with the same name in our private feed.

Why does specifying package source with -s not work? How do I fix it?

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

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

发布评论

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

评论(1

神魇的王 2025-02-12 14:55:06

microsoft文档

-s | -source&lt; source&gt;

在还原操作期间要使用的Nuget软件包的URI。

所以我希望命令会这样:

dotnet add package -s https://nuget.pkg.github.com/... PackageName

The Microsoft docs are saying:

-s|--source <SOURCE>

The URI of the NuGet package source to use during the restore operation.

So I'd expect the command to be like this:

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