NuGet + Package Restore = Failed Build?

Recently we faced weird issue with NuGet. Then we build our solution (with Package Restore enabled) build fails due to the NuGet error.

We have some packages from the internal NuGet server, hence in NuGet.targets we had this:

<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<packagesources>
&quot;https://nuget.org/api/v2/;http://ournuget.com/nuget&quot;
</packagesources>

NuGet output was: One or more errors occurred

The command was:

"c:\ProjectPath\.nuget\nuget.exe" install "c:\ProjectPath\Source\ProjectName\packages.config" -source "https://nuget.org/api/v2/;http://ourinternalnugetserver.com/nuget" -o "c:\ProjectPath\packages"

What’s interesting if you run NuGet with empty -source you get nice warning:

WARNING: The schema version of 'Rx-PlatformServices' is incompatible with version 1.8.30524.9000 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.

*I got above warning after executing below command

"c:\ProjectPath\.nuget\nuget.exe" install "c:\ProjectPath\Source\ProjectName\packages.config" -source "" -o "c:\ProjectPath\packages"

Next steps are obvious “nuget update –self” did the trick.

nuget update –self