Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Find-Package fails to find existing NuGet package #678

Description

@simone-cw

When I run the following command:

Find-Package -Name Microsoft.Web.Xdt -ProviderName NuGet

I get this error:

Find-Package: No match was found for the specified search criteria and package name 'Microsoft.Web.Xdt'. Try Get-PackageSource to see all available registered package sources.

The Microsoft.Web.Xdt can be found on the NuGet site, which indicates an issue with the Find-Package command

After enabling the debug log with $DebugPreference = "Continue", the command logs the following stacktrace

DEBUG: 00:00:00.8843185 System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.PackageManagement.NuGetProvider.NuGetRequest.GetPackageById(PackageSource source, String name, NuGetRequest request, String requiredVersion, String minimumVersion, String maximumVersion, Boolean minInclusive, Boolean maxInclusive, Boolean isDependency)
DEBUG: 00:00:00.8844229 Completed iterating for 'Microsoft.Web.Xdt'.
DEBUG: 00:00:01.1371486 unmatched package name='Microsoft.Web.Xdt'

It seems that the error goes away if I add a wilcard at the start of the package name

Find-Package -Name "*Microsoft.Web.Xdt" -ProviderName NuGet

However, this is not a good solution as it might return additional non-relevant packages.

Activity

  1. SydneyhSmith commented on Apr 21, 2022

    @SydneyhSmith
    Collaborator

    Thanks for opening this issue, can you please share the versions of packagemangement and powershellget you are using?

  2. schrufygroovy commented on Aug 19, 2022

    @schrufygroovy

    +1 please fix

  3. simone-cw commented on Aug 19, 2022

    @simone-cw
    Author

    Hi Sydney Smith (@SydneyhSmith)

    My apologies for the late reply. I must have missed the notification with your comment.
    I have now tried to run the command again but I am unable to replicate it. I might now have a more recent versions of the underneath dependencies, so since the error is gone I can consider it resolved.

    If it is of any help I can provide the packagemangement and powershellget versions, but I'd need instructions on how to do it?

    Might be worth following up with David Schruf (@schrufygroovy) as well as it seems they're still able to reproduce it.

  4. schrufygroovy commented on Aug 22, 2022

    @schrufygroovy

    In my case I am dealing with a private azure devops nuget feed.

    With package source:

    https://pkgs.dev.azure.com/<ORGANISATION>/_packaging/<FEED>/nuget/v3/index.json
    

    He is able to find the package and package information and download the json from nuget feed, but the information is somehow missing some PackageSource / PackageSource.Location leading to

    DEBUG: 00:00:07.4432563 'PackageSource or PackageSource.Location or Package object' is 'null'.
    
    DEBUG: 00:00:00.1339175 System.ArgumentNullException: Value cannot be null. (Parameter 'source')
       at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
       at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
       at Microsoft.PackageManagement.NuGetProvider.NuGetRequest.GetPackageById(PackageSource source, String name, NuGetRequest request, String requiredVersion, String minimumVersion, String maximumVersion, Boolean minInclusive, Boolean maxInclusive, Boolean isDependency)
    

    As workaround one can configure old v2 azure devops nuget feed

    https://pkgs.dev.azure.com/<ORGANISATION>/_packaging/<FEED>/nuget/v2
    
  5. anamnavi commented on Sep 15, 2022

    @anamnavi
    Member

    David Schruf (@schrufygroovy) simone-cw can you try this scenario out with PowerShellGetV3? https://www.powershellgallery.com/packages/PowerShellGet/3.0.17-beta17

    You can register a repository with the private azure devops V3 feed, and use the Find-PSResource <pkgName> cmdlet. Unfortunately we're no longer fixing issues for PowerShellGetV2, but would love to hear your feedback of whether this works in PowershellGetv3. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions