首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powershell Find-Package失败,无法解析程序包源

Powershell Find-Package失败,无法解析程序包源
EN

Stack Overflow用户
提问于 2019-11-29 00:10:58
回答 1查看 2.4K关注 0票数 1

我需要从本地artifactory下载包。在大多数服务器上,它都能正常工作。在我的所有服务器上,我注册了我的包源,如下所示:Register-PackageSource -name artifactory -source <url> -credential $cred

这显示为已注册的包源。我可以在之后安装包。但是当我在一台服务器上这样做时

find-package -source artifactory -cedential $cred

我得到了

warning: Unable to resolve package source.

当我使用nuget.exe从有问题的服务器上的相同来源下载包时,它可以正常工作。

Find-Package的完整调试如下所示:

代码语言:javascript
复制
    Find-Package -Source artifactory -Credential $a -debug
DEBUG: 00:00:00 Calling 'NuGet'::'ResolvePackageSources'.
DEBUG: 00:00:00.0000428 There are '1' registered sources in 'NuGet' provider.
DEBUG: 00:00:00.0000678 Source 'artifactory' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:00.0001575 Returning the call 'NuGet'::'ResolvePackageSources'.
DEBUG: 00:00:00.0031715 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0031921 Source: artifactory
DEBUG: 00:00:00.0032059 Debug: True
DEBUG: 00:00:00.0032193 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0044898 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0050695 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0123440 Yielding packge source for artifactory at location <url>
DEBUG: 00:00:00.0136324 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0167879 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0168089 Source: artifactory
DEBUG: 00:00:00.0168245 Debug: True
DEBUG: 00:00:00.0168406 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0175470 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0181642 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0202099 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0232016 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0232204 Source: artifactory
DEBUG: 00:00:00.0232338 Debug: True
DEBUG: 00:00:00.0232476 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0239241 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0244632 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0290160 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0370987 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0371197 Source: artifactory
DEBUG: 00:00:00.0371340 Debug: True
DEBUG: 00:00:00.0371478 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0386468 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0392207 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0473311 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:01.4844827 Calling 'NuGet'::'ResolvePackageSources'.
DEBUG: 00:00:01.4845380 There are '1' registered sources in 'NuGet' provider.
DEBUG: 00:00:01.4845617 Source 'artifactory' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:01.4846514 Returning the call 'NuGet'::'ResolvePackageSources'.
DEBUG: 00:00:01.4901293 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:01.4901498 Source: artifactory
DEBUG: 00:00:01.4901645 Debug: True
DEBUG: 00:00:01.4901810 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:01.4911325 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:01.4917059 In PowerShellGet Provider - 'Resolve-PackageSource'.
VERBOSE: Repository details, Name = 'artifactory', Location = '<url>'; IsTrusted = 'True'; IsRegistered = 'True'.
DEBUG: 00:00:01.4959606 Yielding packge source for artifactory at location <url>
DEBUG: 00:00:01.4977898 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:01.4980451 Calling SearchForPackages. Name=''
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
DEBUG: 00:00:01.4989858 PackageProvider::FindPackage with name 
DEBUG: 00:00:01.4991884 Calling SearchForPackages After Select 1
DEBUG: 00:00:01.5013390 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:01.5013608 Source: artifactory
DEBUG: 00:00:01.5013751 Debug: True
DEBUG: 00:00:01.5013889 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:01.5036350 INVOKING PowerShell Fn Find-Package with args System.String[], , ,  that has length 4
DEBUG: 00:00:01.5043749 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:01.5050108 OPTION: Source => artifactory
DEBUG: 00:00:01.5056124 OPTION: Debug => True
DEBUG: 00:00:01.5059993 OPTION: Credential => System.Management.Automation.PSCredential
VERBOSE: Using the specified source names : 'artifactory'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is '<url>' and PackageManagementProvider is 'NuGet'.
DEBUG: 00:00:01.5160250 PackageProvider::FindPackage with name 
DEBUG: 00:00:01.5180770 Calling 'NuGet'::'FindPackage' - name='', requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:01.5181046 Iterating ''.
VERBOSE: Total package yield:'0' for the specified package ''.
DEBUG: 00:00:01.5181439 Completed iterating for ''.
DEBUG: 00:00:01.5181729 Iterating ''.
DEBUG: 00:00:01.5183139 There are '1' registered sources in 'NuGet' provider.
DEBUG: 00:00:01.5183635 Source '<url>' is not one of the registered sources in 'NuGet' provider.
WARNING: Unable to resolve package source '<url>'.
VERBOSE: Total package yield:'0' for the specified package ''.
DEBUG: 00:00:02.0854817 Completed iterating for ''.
DEBUG: 00:00:02.0859780 PowerShell Script 'PSModule' Function 'Find-Package' returns null.
DEBUG: 00:00:02.0868834 Done calling powershell «Find-Package» «
EN

回答 1

Stack Overflow用户

发布于 2019-11-29 21:30:53

解决方案是:

在此处更新Nuget提供程序程序集后,nuget提供程序的版本为2.8.5.201

C:\Program Files\PackageManagement\ProviderAssemblies\nuget\

还有这里

%localappdata%\PackageManagement\ProviderAssemblies\nuget to

2.8.5.208

一切正常。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59092802

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档