0

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

Find-Package -Source "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
Sinto
  • 3,915
  • 11
  • 36
  • 70
umeshWeb
  • 53
  • 8

1 Answers1

0

You are trying to search for packages inside a packages.config, which is incorrect for the following reasons -

  1. Packages.Config is a file which is stored along with your project to track the packages that you have referenced. 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. You can read more about the find package command here. E.g. -

Find-Package nuget.versioning -Source https://api.nuget.org/v3/index.json example snapshot

If you want to get current version of all packages installed to your project you need to use the Get-Package command described here. E.g. -

Get-Package -ProjectName NuGet.Versioning enter image description here

Ankit Mishra
  • 474
  • 3
  • 11