我已经克隆了朋友的回购,而我正在做Restore NugetPackages,很多软件包都无法获得。
在输出中我得到了很多记录,如:
log : Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/nunit/index.json'.
log : The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/nunit/index.json' has timed out after 100000ms.
log : Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/libuv/index.json'.
log : The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/libuv/index.json' has timed out after 100000ms.
log : Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/moq/index.json'.
log : The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/moq/index.json' has timed out after 100000ms.
log : Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/index.json'.
log : The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/index.json' has timed out after 100000ms.
/*...CODE REMOVED FOR READABILITY...*/
log : The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration.fileextensions/1.1.0/microsoft.extensions.configuration.fileextensions.1.1.0.nupkg' has timed out after 100000ms.
error: Failed to retrieve information from remote source 'https://api.nuget.org/v3-flatcontainer/nunit/index.json'.
error: The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/nunit/index.json' has timed out after 100000ms.
error: Failed to retrieve information from remote source 'https://api.nuget.org/v3-flatcontainer/nunit/index.json'.
error: The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/nunit/index.json' has timed out after 100000ms.
工具
Visual Studio 2015社区,更新3。
dotnet --version 1.0.0-preview2-003131
Nuget 3.5.0
一个 package.json 文件 ` { “title”:“Ghp”, “版本”:“1.0.0”, “描述”:“Ghp”, “copyright”:“”, “作者”:[“”],
"packOptions": {
"tags": [ "ghp" ],
"projectUrl": "",
"licenseUrl": "",
"repository": {
"type": "git",
"url": ""
}
},
"buildOptions": {
"emitEntryPoint": false
},
"frameworks": {
"netstandard1.6": {
"imports": [
"dnxcore50",
"portable-net451+win8"
]
},
"net46": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": "4.0.0.0"
}
}
},
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.1.0",
"Newtonsoft.Json": "9.0.1",
"Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
"Microsoft.EntityFrameworkCore.Relational": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.Extensions.Configuration": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Localization": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"System.Diagnostics.StackTrace": "4.3.0"
}
}`
如果有人知道,请给我一个提示如何解决Nuget恢复问题。
感谢。
答案 0 :(得分:1)
问题是因为我安装了Microsoft .NET Core 1.x.x - SDK 1.x.x Preview-x
的多个版本,Microsoft .NET Core 1.x.x - VS 2015 Tooling Preview-x
的版本相同。
解决方案是卸载所有旧的 SDK 和 VS 2015 Tooling ,然后下载并安装https://www.microsoft.com/net/download/core上提供的最新版本
之后,正确恢复了包,并且解决方案已成功重建。
现在我有了这套工具:
- Microsoft .NET Core 1.0.1 - SDK 1.0.0 Preview 2-003131 (x64)
,
- Microsoft .NET Core 1.0.1 - VS 2015 Tooling Preview 2
,
- Microsoft .NET Core 1.0.3 - SDK 1.0.0 Preview 2-003156 (x64)
,
- Microsoft .NET Core 1.1.0 - Runtime (x64)
,
- Visual Studio Community 2015 Update 3
答案 1 :(得分:0)
您是否可以访问要恢复的浏览器中的来源,例如https://api.nuget.org/v3-flatcontainer/nunit/index.json?如果是,您可以使用以下方法作为临时解决方案:
请注意:“FindPackagesByIdAsync”软件包应该是一个客户软件包,在将其推送到NuGet.org或服务器之前无法下载。需要获取此包并将其设置到本地存储库中。
如果无法访问这些来源,则需要检查网络设置。
答案 2 :(得分:0)
我在 vs 2019 中也遇到了这个问题。
我在 Windows 10 上安装了 .net core sdk 3.1 和 5。
卸载 .net core 3.1 后,此问题解决。