"Restore failed" 用于 Rider 的模板项目

"Restore failed" for Rider's Template Project

我的全新 JetBrains Rider 实例有问题。下载并创建模板项目“ASP .NET Web 应用程序”后,我在尝试下载 NuGet 包时收到以下错误消息:

Restore failed 
Restore failed for 14 packages in 1 project

日志是

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

packages/ 文件夹不存在。

我安装了几个其他程序(如 .NET Framework 甚至 Visual Studio),我下载了 nuget.exe 并将其放入 PATH 环境变量中。我将项目移动到硬盘驱动器周围,因为 Rider 可能需要特殊权限,甚至创建了文件夹。到目前为止没有任何帮助。

当我手动输入 nuget restore 时,我收到以下消息:

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\'.

如何修复此错误消息并在 Rider 中下载 NuGet 包?

似乎下载 nuget.exe 并将其放入 PATH 环境变量中是正确的。另外,我必须将其添加到 C:\Users\AppData\NuGet\NuGet.config:

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

然后调用nuget restore,14个包下载成功。我还没有找到详细说明这些步骤的手册,所以我不确定是否缺少更多内容。