vNext项目编译时VS 2015“依赖无法解决”错误

时间:2015-11-04 21:22:13

标签: visual-studio-2015 asp.net-core asp.net-core-mvc dnx

我正在尝试将Newtonsoft.json nugget包添加到我的项目中并在编译时收到以下错误,

“NU1001无法解析依赖项Newtonsoft.Json> = 7.0.1。”

如果我安装软件包版本< = 6.0.6,它可以正常工作。我还尝试从项目根文件夹中的powershell运行 dnu restore (显然是为其他人工作)。同样的错误。还尝试通过Nugget管理器进行安装,并直接在project.json中添加包名,让VS自行恢复。

我正在尝试在dnx451框架beta8版本上构建。

是否有任何默认的Framework依赖项需要6.0.6版本?如果是这样,有没有解决方法。我有其他项目需要最新的nugget包,当从vNext项目引用时,抛出引用不匹配错误。

感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

您可以包含Newtonsoft.json 7.0.1。你的project.json可能有问题。

这是我的project.json。

{
"webroot": "wwwroot",
"userSecretsId": "aspnet5-GGZDBC5-d96c66a6-1a4e-4a9a-b8d4-11c2f88ff638",
"version": "1.0.0-*",
"dependencies": {
    "CsvHelper": "2.13.1",
    "EntityFramework.Commands": "7.0.0-beta8",
    "EntityFramework.SqlServer": "7.0.0-beta8",
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.Google": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta8",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta8",
    "Microsoft.AspNet.Http": "1.0.0-beta8",
    "Microsoft.AspNet.Http.Features": "1.0.0-beta8",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta8",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
    "Microsoft.AspNet.Mvc": "6.0.0-beta8",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta8",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
    "Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
    "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta8",
    "Microsoft.Framework.Logging": "1.0.0-beta8",
    "Microsoft.Framework.Logging.Console": "1.0.0-beta8",
    "Microsoft.Framework.Logging.Debug": "1.0.0-beta8",
    "Microsoft.Framework.SecretManager": "1.0.0-beta8",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8",
    "Newtonsoft.Json": "7.0.1-*",
    "Mvc6.JQuery.Datatables": "1.0.0-*",
    "npm": "1.4.15.2",
    "TagHelpers": "1.0.0-*"
},
"commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"
},
"frameworks": {
    "dnx451": {
        "dependencies": {
            "DataTables": "1.0.0-*",
        },
        "frameworkAssemblies": {
            "System.Web": "4.0.0.0"
        }
    }
},
"exclude": [
    "wwwroot",
    "node_modules"
],
"publishExclude": [
    "**.user",
    "**.vspscc",
    "Metronic"
],
"scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}

这是我的dnu恢复结果

c:\git\DBC\src\DBC>dnu restore
Microsoft .NET Development Utility Clr-x86-1.0.0-beta8-15858  

CACHE https://www.myget.org/F/aspnetrelease/api/v3/index.json
CACHE http://www.myget.org/F/azureadwebstacknightly/api/v3/index.json
CACHE https://api.nuget.org/v3/index.json
Restoring packages for c:\git\DBC\src\DBC\project.json
GET     https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/newtonsoft.json/index.json
GET     https://www.myget.org/F/azureadwebstacknightly/api/v3/flatcontainer/newtonsoft.json/index.json
CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
NotFound     https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/newtonsoft.json/index.json 359ms
NotFound     https://www.myget.org/F/azureadwebstacknightly/api/v3/flatcontainer/newtonsoft.json/index.json 1406ms
Writing lock file c:\git\DBC\src\DBC\project.lock.json
Restore complete, 3216ms elapsed

NuGet Config files used:
C:\Users\Thom\AppData\Roaming\NuGet\nuget.config

Feeds used:
https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/
https://www.myget.org/F/azureadwebstacknightly/api/v3/flatcontainer/
https://api.nuget.org/v3-flatcontainer/