簡體   English   中英

Dotnet 還原為 NuGet package 提供 301 錯誤

[英]Dotnet restore gives 301 error for a NuGet package

我的代碼昨晚運行良好,但是當我今天嘗試使用dotnet restore恢復它時,出現以下錯誤。

Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.identity.ui/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/fluentvalidation/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Failed to download package 'Microsoft.EntityFrameworkCore.3.1.8' from 'https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore/3.1.8/microsoft.entityframeworkcore.3.1.8.nupkg'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Failed to download package 'Microsoft.EntityFrameworkCore.3.1.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore/3.1.1/microsoft.entityframeworkcore.3.1.1.nupkg'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.extensions.fileproviders.embedded/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/serilog.sinks.console/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.text.regularexpressions/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).

我正在使用 Ubuntu 20.04,我的 dotnet 配置如下

.NET Core SDK (reflecting any global.json):
 Version:   3.1.414
 Commit:    88a3b0c5ca

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.414/

Host (useful for support):
  Version: 3.1.20
  Commit:  2833dab8c3

.NET Core SDKs installed:
  3.1.414 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

但是,如果我嘗試直接訪問這些 URL,我可以訪問它們嗎? 我也在使用VPN。 會不會是因為這個?

我已經設法解決了這樣的問題:

1- 從這里下載 Nuget.exe

2-將Nuget.exe添加到windows路徑(可以復制到c:/windows/system32)

3-打開命令行並導航到您的解決方案文件夾並運行以下命令:

nuget.exe 恢復-DisableParallel

希望它有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM