Search code examples
rider

"Restore failed" for Rider's Template Project


I have a problem with my brand new instance of JetBrains Rider. After downloading it and creating the template project "ASP .NET Web Application" I get the following error message when trying to download NuGet packages:

Restore failed 
Restore failed for 14 packages in 1 project

The log is

[Notification][Restore] Restore failed
Restore failed for 14 packages in 1 project

The packages/ folder does not exist.

I installed a couple of other programms (like the .NET Framework and even Visual Studio), I downloaded the nuget.exe and put it in the PATH environment variable. I moved the project around the hard drive because maybe Rider needs special permissions and even created the folder. Nothing helped so far.

When I type nuget restore manually, I get the following essage:

nuget : Errors in packages.config projects
At line:1 char:1
+ nuget restore
+ ~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Errors in packages.config projects:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
    Unable to find version '3.5.0.2' of package 'Antlr'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Antlr.3.5.0.2' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '1.17.0' of package 'jQuery.Validation'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'jQuery.Validation.1.17.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '3.3.1' of package 'jQuery'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'jQuery.3.3.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '3.4.1' of package 'bootstrap'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'bootstrap.3.4.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '1.1.3' of package 'Microsoft.AspNet.Web.Optimization'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Web.Optimization.1.1.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '5.2.7' of package 'Microsoft.AspNet.Mvc'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Mvc.5.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '3.2.7' of package 'Microsoft.AspNet.Razor'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Razor.3.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '3.2.7' of package 'Microsoft.AspNet.WebPages'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.WebPages.3.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '2.8.3' of package 'Modernizr'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Modernizr.2.8.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '1.0.0' of package 'Microsoft.Web.Infrastructure'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.Web.Infrastructure.1.0.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '1.6.0' of package 'WebGrease'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'WebGrease.1.6.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '3.2.11' of package 'Microsoft.jQuery.Unobtrusive.Validation'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.jQuery.Unobtrusive.Validation.3.2.11' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '2.0.0' of package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Unable to find version '11.0.1' of package 'Newtonsoft.Json'.
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Newtonsoft.Json.11.0.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.

How can I fix this error message and download NuGet packages in Rider?


Solution

  • It seems downloading the nuget.exe and putting it in the PATH environment variable was correct. Additional, I had to add this to C:\Users<username>\AppData\NuGet\NuGet.config:

    <configuration>
      <!-- stuff -->
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <!-- other stuff -->
      </packageSources>
    </configuration>
    

    Then I called nuget restore and the 14 packages were successfully downloaded. I haven't found a manual detailing this steps yet, so I'm not sure if more is missing.