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

@simone-cw

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.

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