I have a VS 2015 Community solution with a single ASP.NET MVC C# project that has been working correctly, but all of the sudden NuGet starts behaving flaky after installing and uninstalling a package. The package name was Bogus
which is a port of the Faker library that generates Fake data. The Bogus
package didn't quite do all I needed, so I attempted to uninstall it using Nuget. An error occurred, but I don't remember what the error said. :S
After trying a few simple things like cleaning the solution, restarting VS, and emptying the ./packages
folder and rebuilding, the problem persists.
So I shut down VS and rebooted. Then removed the contents of the AppData/Local/Nuget/cache/
and again removed all contents of the solution's packages/
folder (again). Restarted VS and performed a Build. No errors, but I still have symptoms:
Package Manager no longer recognizes the 'Add-Migration' command:
PM> add-migration Misc1 add-migration : The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
- add-migration Misc1
- ~~~~~~~~~~~~~
- CategoryInfo : ObjectNotFound: (add-migration:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
NuGet cannot uninstall/update most of the project's installed packages. As an example, I have WebGrease v1.5.2 installed and Latest stable v1.6.0 is available. When I click the Update button I receive the following error in VS Error List pane:
Error An error occurred while retrieving package metadata for 'Newtonsoft.Json.10.0.3' from source 'C:\Users\ME\Projects\MyProject\packages'. 0
and the following error in the Output pane:
Attempting to gather dependencies information for package 'WebGrease.1.6.0' with respect to project 'MyProject', targeting '.NETFramework,Version=v4.6.1' An error occurred while retrieving package metadata for 'Newtonsoft.Json.10.0.3' from source 'C:\Users\ME\Projects\MyProject\packages'. ========== Finished ==========
I'm really stuck at this point. I have no idea how to fix this/these problem(s) and it's cost me a day of downtime already.
One thing that's odd is that I can apparently downgrade Newtonsoft.Json to 10.0.2 and then Update it to 10.0.3 again without any errors seemingly. Can't uninstall it though and like I said, all of the other installed packages I've tried to update or uninstall generate an error - usually pointing to Newtonsoft.Json like above.
Here is packages.config:
<packages>
<package id="Antlr" version="3.4.1.9004" targetFramework="net461" />
<package id="bootstrap" version="3.0.0" targetFramework="net461" />
<package id="EntityFramework" version="6.1.3" targetFramework="net461" />
<package id="jQuery" version="1.10.2" targetFramework="net461" />
<package id="jquery.datatables" version="1.10.15" targetFramework="net461" />
<package id="jQuery.Validation" version="1.11.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="1.2.3" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="1.2.0" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="1.2.3" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.JavaScript" version="0.15.0-build58334" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="1.2.3" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.Web" version="1.2.3" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="1.2.3" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="1.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net461" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net461" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net461" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net461" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net461" />
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.Owin" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Security" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Security.Cookies" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Security.Facebook" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Security.Google" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Security.OAuth" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Security.Twitter" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
<package id="Modernizr" version="2.6.2" targetFramework="net461" />
<package id="NBuilder" version="5.0.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
<package id="Owin" version="1.0" targetFramework="net461" />
<package id="Respond" version="1.2.0" targetFramework="net461" />
<package id="WebGrease" version="1.5.2" targetFramework="net461" />
</packages>