Press "Enter" to skip to content

VS2015 NuGet restore NullReferenceException

Last week I installed Visual Studio 2015 RTM, after using the beta and RC versions. When I tried to build a solution I got a NullReferenceException when VS tried to restore the nuget packages. Some packages were restored fine, others didn’t. One of them was NUnit 2.6.3. The weird thing was that it worked when I downloaded the package manually and copied it to a local NuGet folder. When I tried to install 2.6.4 or 2.6.2, it worked like a charm. So my only option was the NuGet cache. In VS2015 the option to clear the cache is removed (why?), so I had to manually clear:

%USERPROFILE%\.nuget\packages

This was the problem, the next build worked fine.