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

查看:135
本文介绍了无法在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 'UI\MyApplication.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:\Users\Keith\Source\Workspaces\MyApplication\MyApplication.MVC\packages'
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}}\AppData\Roaming\
  • 删除Nuget.config
  • 重新启动VS很好
  • Go to this path: C:\Users\{{username}}\AppData\Roaming\
  • Delete Nuget.config
  • Restart VS for good measure

供参考:在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天全站免登陆