3

尝试运行 Register-PsRepository 时出现以下错误

我试过了:

  • 重新安装 WMF 5、PowerShellGet 和 PackageManagement 模块
  • 更新所述模块
  • 调试 PowerShellGet 模块我可以看到 PsBoundParameters 确实将 Name 值传递给 Register-PackageSource 命令。
  • 当我手动运行 Register-PackageSource 时,它​​确实可以正常工作。

有任何想法吗?

PS C:\> Register-PSRepository -Name MyRepo -SourceLocation  https://MyRepo.com/api/Myrepo   -Credential $c
PackageManagement\Register-PackageSource : The property 'Name' cannot be 
found on this object. Verify that the property exists.
At C:\Program  Files\WindowsPowerShell\Modules\PowerShellGet\1.6.0\PSModule.psm1:4631 char:17
4

1 回答 1

5

请检查 PSRepository 配置 xml 文件:

%localappdata%\Microsoft\windows\PowerShell\PowerShellGet\PSRepositories.xml

文件可能已损坏,这可能会导致您遇到错误。

于 2018-05-08T15:03:13.620 回答