运行 dotnet restore 命令时出现下面的错误:
error: Unable to resolve NETStandard.Library (>= 1.0.0) for .NETStandardApp,Version=v1.3.
dotnet cli 的版本是:
.NET Command Line Tools (1.0.0-dev-001698)
project.json 中的内容是:
{ "version": "3.2.4", "summary": "EnyimMemcached", "frameworks": { "netstandardapp1.3": { "dependencies": { "NETStandard.Library": "1.0.0-*" }, "imports": [ "dnxcore50", "portable-net45+win8" ] } }, "configurations": { "Debug": { "compilationOptions": { "allowUnsafe": true } }, "Release": { "compilationOptions": { "allowUnsafe": true } } }, "dependencies": { "Microsoft.Extensions.Logging.Abstractions":"1.0.0-*" } }
在当前程序的文件夹中添加如下内容的NuGet.Config文件后,问题解决:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <clear /> <add key="AspNetCI" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" /> <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" /> </packageSources> </configuration>