来自Visual Studio Team Services的未经授权的nuget程序包,使用asp.net core rc2 [英] Unauthorized nuget package from Visual Studio Team Services using asp.net core rc2
问题描述
我无法从asp.net核心Web应用程序(RC2)中的Visual Studio Team Services提要安装/还原nuget程序包.我收到以下信息:
I am unable to install/restore nuget packages from a Visual Studio Team Services feed in an asp.net core web application (RC2). I receive the following:
错误:响应状态代码不指示成功:401 (未经授权).
error: Response status code does not indicate success: 401 (Unauthorized).
我正在运行Visual Studio Community 2015 Update 2和nuget版本3.4.4.我可以从其他其他项目类型的Feed中安装/恢复软件包.
I am running Visual Studio Community 2015 Update 2 and nuget version 3.4.4. I am able to install/restore packages from this feed in other project types.
我需要做其他事情来传递我的asp.net核心网络应用程序的凭据吗?
Do I need to do something else to pass my credentials for an asp.net core web app?
复制步骤:
从团队服务"包选项卡中,选择连接到源"并复制NuGet包源URL
From Team Services package tab I select "Connect to Feed" and copy the NuGet package source URL
在Visual Studio中->工具-> NuGet程序包管理器->程序包管理器设置->程序包源,并从vso添加供稿网址
In visual studio -> Tools -> NuGet Package Manager -> Package Manager settings -> Package sources and add the feed url from vso
然后从我的ASP.NET Core Web应用程序(.NET Framework)项目中右键单击引用->管理NuGet包 ->从程序包来源"中选择我的提要(列出了程序包)->单击以安装
Then from my ASP.NET Core Web Application (.NET Framework) project right click references -> Manage NuGet Packages -> Select my feed from Package source (packages are listed) -> Click to install
在输出中:
Installing NuGet package xxxxx
Successfully installed xxxxx to WebApplication1
========== Finished ==========
然后它将尝试恢复我得到的软件包:
Then it will try to restore the package at which point I get:
error: Response status code does not indicate success: 401 (Unauthorized).
error: Failed to retrieve information from remote source
以及内部Web项目引用-程序包中带有警告图标-NU1001无法解析依赖项xxxxx
And inside web project references - package has warning icon - NU1001 The dependency xxxxx could not be resolved
推荐答案
我可以在您的身边重现您的问题,以下是我用来还原软件包的解决方法:
I can reproduce your issue at my side and following is the workaround I use to restore the packages:
- 从"VS \ Tools \ NuGet程序包管理器\包源"中删除VSTS提要资源.
- 从VSTS网站门户中打开软件包"标签.
- 选择要连接的供稿,然后单击连接到供稿"选项.
- 在对话框中选择个人访问令牌"方法.
- 在对话框中复制生成的命令.
- 在计算机上以管理员身份运行CMD.
- 将复制的命令粘贴到CMD中.
- 在命令后添加"-StorePasswordInClearText"参数.
- 运行命令.
- 重新启动VS.
- 安装和还原软件包.
- Remove the VSTS feed resource from "VS\Tools\NuGet Package Manager\Package sources".
- Open "Packages" tab from your VSTS web portal.
- Select the feed you want to connect and click "Connect to feed" option.
- Select "Personal Access Tokens" method in the dialog.
- Copy the generated command in the dialog.
- Run CMD as Administrator on you machine.
- Paste the copied command into CMD.
- Add "-StorePasswordInClearText" argument after the command.
- Run the command.
- Restart the VS.
- Install and restore the packages.
这篇关于来自Visual Studio Team Services的未经授权的nuget程序包,使用asp.net core rc2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!