5

I have visual studio 2015 community edition and I am trying to use the NuGet package manger to install HTML Agility Pack into my project.

Firstly, the search wasn't working and I could not install it via command line also. So, I uninstalled the extension and re-installed it and still doesn't work.

Here's the screenshot of search not working and command line install failure:

enter image description here

PM> Install-Package HtmlAgilityPack Install-Package : Object reference not set to an instance of an object. At line:1 char:1 + Install-Package HtmlAgilityPack + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand 

Any idea how to fix this?

1

5 Answers 5

12

Fix :

  1. Close your Visual Studio.

  2. Navigate to %AppData%\NuGet\ folder

  3. Delete the NuGet.config file

  4. Now open Visual Studio. You can notice that a new NuGet.Config file is generated

Issue will be fixed.

Sign up to request clarification or add additional context in comments.

Comments

1

Try updating the Nuget Package Manager. I experienced this issue after updating to Visual Studio 2015 Update 2

This can be done via Tools > Extensions and Updates

Comments

1

My issue is kind of similar to this one, search wasn't working but console was working fine without error.

I figured out a workaround, if you've never modified your personal NuGet.config file at %appdata%\nuget\ or never customized your NuGet sources, delete the file then restart Visual Studio, this will trigger the NuGet extension to create a fresh copy of the default NuGet.config file, and search functionality will work again as supposed to.

Comments

0

In 'Package source:', select 'All' or 'nuget.org'.

Comments

0

Try to update the NuGet Package, it worked for me once.

1 Comment

this is a blank project with no nuget packages loaded into it. I have nothing to update. I am trying to install a new package into a blank project.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.