【问题标题】:Is there any way to view Nuget package sources available for visual studio directly from command line有什么方法可以直接从命令行查看可用于 Visual Studio 的 Nuget 包源
【发布时间】:2021-07-31 05:58:37
【问题描述】:

如何通过命令行在 Visual Studio 中查看 Nuget 包源,而无需在 Visual Studio 中设置包管理器?此外,dotnet cli 还通过运行“dotnet nuget list source”命令显示 nuget 包源。 dotnet cli输出的这些源是否与VS中的nuget源相同?

【问题讨论】:

  • 它们是一样的吗?为什么不尝试将源添加到 VS,然后查看 CLI 是否输出它?
  • 我有点害怕我会搞砸一切。因此,我提出了这个问题。
  • 你的所有代码都在 git 中,对吧?如果不这样做。您可以将任何更改还原回来。

标签: c# visual-studio .net-core command-line nuget


【解决方案1】:

您可以在此处下载 nuget.exe:https://www.nuget.org/downloads

然后运行这个命令:nuget.exe sources List

也可以直接查看%appdata%\NuGet中的NuGet.Config文件(完整路径:C:\Users\ {username} \AppData\Roaming\NuGet)

【讨论】:

  • 感谢您的回答。我没有使用过独立的 nuget,但是,我使用了 dotnet core cli 附带的 nuget。因此,在修改 NuGet.config 中的 nuget 源标记后,这些修改会在执行 dotnet nuget list source 命令时显示。此外,如果我删除 NuGet.config 文件,则在我从 dotnet cli 执行任何 nuget 命令后会重新生成该文件。
  • 当我运行dotnet nuget list source 时,会显示此链接“api.nuget.org/v3/index.json”。此外,在 NuGet.config 中,内容为:<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />,其中值为 value="api.nuget.org/v3/index.json"。我只想确定源的网络链接是否是官方的nuget源链接。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-26
  • 1970-01-01
  • 1970-01-01
  • 2020-02-11
  • 1970-01-01
  • 2017-01-09
  • 2014-10-28
相关资源
最近更新 更多