无法使用VS2012从VSTS nuget安装nuget软件包

时间:2017-09-13 06:03:20

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

无法使用VS2012从Visual Studio团队服务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

1 个答案:

答案 0 :(得分:1)

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

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

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