无法在 Visual Studio 2015 中安装任何包 [英] Unable to Install Any Package in Visual Studio 2015

查看:19
本文介绍了无法在 Visual Studio 2015 中安装任何包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了我可能找到的所有软件包,但没有一个会安装在我的项目中.我已经安装了可用的扩展和更新列表中列出的每个更新.例如,当我尝试安装 SendGrid 时,结果如下(与所有其他包的结果一样):

I've tried every package I could possibly find and none of them will install in my project. I've installed every update listed in the Extensions and Updates list that were available. When I attempt to install SendGrid for example, this is the result (as is the result with all other packages):

Attempting to gather dependencies information for package 'Sendgrid.6.1.0' with respect to project 'UIMyApplication.MVC', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'Sendgrid.6.1.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Sendgrid.6.1.0'
Resolved actions to install package 'Sendgrid.6.1.0'
For adding package 'SendGrid.SmtpApi.1.3.1' to project 'MyApplication.MVC' that targets 'net452'.
For adding package 'SendGrid.SmtpApi.1.3.1' to project 'MyApplication.MVC' that targets 'net452'.
Adding package 'SendGrid.SmtpApi.1.3.1' to folder 'C:UsersKeithSourceWorkspacesMyApplicationMyApplication.MVCpackages'
Install failed. Rolling back...

我不可能是这个星球上唯一一个在 Visual Studio 2015 和新的和改进的"NuGet 包管理器方面遇到问题的人.

I can't be the only one on the planet having issue with Visual Studio 2015 and the new and "improved" NuGet Package Manager.

更新:
好吧,我的解决方案中一定有些奇怪,因为我从 VS2015 模板 (web) 创建了一个新项目,并且软件包安装得很好.当我发现问题时,我会发布解决方案,以防其他人遇到同样的问题.

UPDATE:
Well, must be something odd in my solution because I created a new project from the VS2015 template (web) and the packages install just fine. When I find out the issue, I'll post the resolution in the event others run into the same problem.

更新 2:
好吧,这不是我们的解决方案.我们再次从头开始创建了一个新的解决方案(这可能浪费了我们大量的开发时间,我可能会添加),添加了几个包(Identity、EF、SendGrid),在将解决方案签入 VSO 后,另一位开发人员执行了新的创建分支和构建错误发生.当我转到单个项目的 NuGet 包时,它就像我添加的包都不可用一样.还有其他人遇到过这种情况吗?

UPDATE 2:
Ok, it's not our solution. We created a new solution from scratch again (this has wasted a lot of our development time might I add), added a couple of packages (Identity, EF, SendGrid) and after checking the solution in to VSO, another developer performs a fresh creation of the branch and build errors occur. When I go to the NuGet packages for an individual project, it acts as though none of the packages I have added are available. Anyone else experiencing this?

推荐答案

tl;dr - 删除:

tl;dr - Delete this:

%AppData%/Nuget/Nuget.config

警告:如果您有自定义 NuGet 源,这将删除它们,您必须重新添加它们.

更长的版本:

您可能损坏了 NuGet 配置.哦不:(

You might have corrupted your NuGet config. Oh no :(

Nuget.config 是一个文件,用于跟踪 NuGet 从中提取的所有位置,以及配置其他内容.更有可能的是,这个 xml 文件不知何故损坏了.

Nuget.config is a file used to keep track of all of the places that NuGet pulls from, as well as configuring other things. More likely than not, this xml file got broken somehow.

  • 转到此路径:C:Users{{username}}AppDataRoaming
  • 删除Nuget.config
  • 重新启动 VS 以获得良好的测量

供参考:在 2017 年的好日子里,您的文件应该是这样的

For reference: in the good days of 2017, your file should look something like this

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <activePackageSource>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
    <!-- Others -->
  </packageSources>
  <packageSourceCredentials>
    <!-- secret stuff -->
  </packageSourceCredentials>
</configuration>

这篇关于无法在 Visual Studio 2015 中安装任何包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆