295

I'm getting "[project] nuget configuration is invalid" error. I received an error like this before and used the 'Update Nuget package manager' solution mentioned here:

Unable to Install Any Package in Visual Studio 2015

I've also tried the other solutions mentioned in that link to no avail.

  • Restarting Visual Studio
  • Deleting nuget.config
  • Deleting packages.config
  • Updating nuGet Package Manager.

Also, I'm able to see the nuGet Packages at the solution level and other projects within this solution.

And, if I go to Package Manager Console (Tools -> NuGet Package Manager -> Package Manager Console), I can't see the projects having this issue in the project drop down, but I see the other projects in the solution.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Ash
  • 5,786
  • 5
  • 22
  • 42

2 Answers2

949

Simply restarting Visual Studio worked for me.

user2441511
  • 11,036
  • 3
  • 25
  • 50
  • 9
    This solution and many others have been listed [here](http://stackoverflow.com/a/34910428/5159431). As mentioned in the question, this is a case where this and many of the listed solutions have already been tried – Ash Dec 04 '16 at 23:52
  • 1
    @AshwinNair Thank you for pointing that out. I added this as an answer because I found this question when I was Googling the error message, and restarting VS was all I needed. So the solutions you mentioned trying in your question actually solved my problem. :) I suspect others have found that to be the case for them as well. – user2441511 Dec 05 '16 at 14:29
  • 2
    It's good to know that one of the solutions mentioned in the question solved your problem. As I mentioned before, this question is a case where those 'solutions' that worked for others hadn't worked. As such, 'restarting VS' isn't an answer to THIS question. I hope people don't take it upon themselves to post the other three solutions as answers as well in case one of the 3 works for them. – Ash Dec 06 '16 at 22:54
  • Any project created using dotnet CLI and then opened on VS 2017 also faces the same problem, restarting VS fixed the problem for me too. – Varun Rathore Mar 24 '17 at 09:56
  • 5
    Closing the solution and reopening it worked for me, rather than restarting visual studio entirely. – aleksk Apr 01 '17 at 13:33
  • I turned on my laptop and opened a new instance of VS. I cloned a project via 3rd party GIT extension. I noticed visual studio opened it as a folder and not a project, I'm not sure if this had any effect of initializing the NPM. It was completely useless though. Restarting Visual Studio and opening the .sln made everything work perfectly. – Zakk Diaz Aug 11 '17 at 21:09
  • Find the package.config file , remove the references (if any ) causing the problem . After you install the packages ,it will get updated automatically – Joe Jan 18 '18 at 20:09
  • 19
    Still works in VS2019. Consistency FTW! – DPH Dec 07 '18 at 13:42
  • VS 2015 works too, thanks – Nima.S-H Dec 09 '18 at 20:26
  • Happened to me after moving some code to a shared project, then linking to it. Reliable fix in VS2019 16.3.0 Preview 1 :P – Ray Aug 02 '19 at 09:56
21

NOTE: This is mentioned in the question but restarting Visual Studio fixes the issue in most cases.

Updating Visual Studio to 'Update 2' got it working again.

Tools -> Extensions and Updates ->Visual Studio Update 2

As mentioned in the question and the link i posted therein, I'd already updated NuGet Package Manager to 3.4.4 prior to this and restarted to no avail, so I don't know if the combination of both these actions worked.

Ash
  • 5,786
  • 5
  • 22
  • 42