【问题标题】:Unable to install nuget packages from VSTS nuget using VS2012无法使用 VS2012 从 VSTS nuget 安装 nuget 包
【发布时间】:2018-02-21 17:12:38
【问题描述】:

无法使用 VS2012 从 Visual Studio Team Services nuget 服务器安装 nuget 包

PM> install-package <package_name> -Source https://<vsts_hostname>/_packaging/Components/nuget/v3/index.json

错误信息:-

install-package : An error occurred while loading packages from 'https://<vsts_hostname>/_packaging/Components/nuget/v3/index.json': 
The remote server returned an error: (404) Not Found.
At line:1 char:1 install-package <package_name> -Source https://<vsts_hostname>...

+ CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

PS:- 相同的 install-package 命令适用于 VS2015 和 VS2017

【问题讨论】:

    标签: visual-studio visual-studio-2012 nuget azure-devops


    【解决方案1】:

    改用 v2 端点。 (将 v3/index.json 替换为 v2):

    install-package <package_name> -Source https://<vsts_hostname>/_packaging/Components/nuget/v2
    

    另一方面,您可以将 VSTS 提要添加到 nuget 源:nuget.exe sources add -name {your feed name} -source {your feed URL} -username {anything} -password {your PAT} -StorePasswordInClearText,然后右键单击 VS 中的项目=> 管理 NuGet 包 =>在线=>选择您添加的包源。

    【讨论】:

    • 没有帮助。使用 v2 时也出现同样的错误
    • @SureshRaja 将 VSTS 提要添加到 nuget 源:nuget.exe 源添加 -name {your feed name} -source {your feed URL} -username {anything} -password {your PAT},然后在VS中右键项目=> Manage NuGet Packages =>Online=>选择你添加的包源。
    • 感谢@starain-MSFT。我必须另外使用 -StorePasswordInClearText 才能使其正常工作。
    猜你喜欢
    • 2019-04-15
    • 2014-02-15
    • 1970-01-01
    • 2017-03-07
    • 1970-01-01
    • 1970-01-01
    • 2020-05-19
    • 2018-08-29
    相关资源
    最近更新 更多