简体   繁体   English

使用源参数查找包无法获取所有nuget包的当前版本

[英]Find Package with source parameter is not working to get the current versions of all the nuget packages

Find Package with source parameter is not working to get the current versions of all the nuget packages 使用源参数查找包无法获取所有nuget包的当前版本

Find-Package -Source " C:\\Users\\P10410559\\source\\repos\\WebApplication4\\WebApplication4\\packages.config " 查找包-源“ C:\\Users\\P10410559\\source\\repos\\WebApplication4\\WebApplication4\\packages.config

Error getting as : 错误为

Find-Package : The following source failed to search for packages: 'C:\Users\P10410559\source\repos\WebApplication4\WebApplication4\packages.config'
The path 'C:\Users\P10410559\source\repos\WebApplication4\WebApplication4\packages.config' for the selected source could not be resolved.
At line:1 char:1
+ Find-Package -Source "C:\Users\P10410559\source\repos\WebApplication4 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Find-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.FindPackageCommand

You are trying to search for packages inside a packages.config, which is incorrect for the following reasons - 您正尝试在packages.config中搜索软件包,由于以下原因,该软件包不正确-

  1. Packages.Config is a file which is stored along with your project to track the packages that you have referenced. Packages.Config是一个文件,与您的项目一起存储,以跟踪您引用的包。 The file is not a package source. 该文件不是软件包源。 You can read more about the file here . 您可以在此处阅读有关该文件的更多信息。
  2. If you want to find packages then you need to pass a real source like nuget.org to the command. 如果要查找软件包,则需要将诸如nuget.org之类的真实源传递给命令。 You can read more about the find package command here . 您可以在此处阅读有关find package命令的更多信息。 Eg - 例如-

Find-Package nuget.versioning -Source https://api.nuget.org/v3/index.json 示例快照

If you want to get current version of all packages installed to your project you need to use the Get-Package command described here . 如果要获取安装到项目中的所有软件包的最新版本,则需要使用此处描述的Get-Package命令。 Eg - 例如-

Get-Package -ProjectName NuGet.Versioning 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM