来自 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.我可以在其他项目类型中从该提要安装/恢复包.
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 核心 Web 应用传递我的凭据?
Do I need to do something else to pass my credentials for an asp.net core web app?
重现步骤:
从 Team Services 包选项卡中,我选择连接到源"并复制 NuGet 包源 URL
From Team Services package tab I select "Connect to Feed" and copy the NuGet package source URL
在visual studio -> Tools -> NuGet Package Manager -> Package Manager settings -> Package sources and add the feed url from 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:
- 从VSToolsNuGet 包管理器包源"中删除 VSTS 源资源.
- 从您的 VSTS 网络门户打开包"选项卡.
- 选择您要连接的 Feed,然后点击连接到 Feed"选项.
- 在对话框中选择个人访问令牌"方法.
- 在对话框中复制生成的命令.
- 在您的机器上以管理员身份运行 CMD.
- 将复制的命令粘贴到 CMD 中.
- 在命令后添加-StorePasswordInClearText"参数.
- 运行命令.
- 重新启动 VS.
- 安装和恢复软件包.
这篇关于来自 Visual Studio Team Services 的未经授权的 nuget 包,使用 asp.net core rc2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!