我需要从本地工件下载包。在大多数服务器上它都有效。在我的所有服务器上,我已经像这样注册了我的包源:
Register-PackageSource -name artifactory -source <url> -credential $cred
这显示为已注册的包源。之后我可以安装软件包。但是,当我这样做时,在一台服务器上
find-package -source artifactory -cedential $cred
我明白了
warning: Unable to resolve package source.
当我使用 nuget.exe 从有问题的服务器上的同一源下载软件包时,它可以正常工作。
Find-Package 的完整调试如下所示:
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» «