6
votes

I am trying to add Newtonsoft.json nugget package to my project and getting the following error on compilation,

"NU1001 The dependency Newtonsoft.Json >= 7.0.1 could not be resolved."

It works fine if I install the package version <= 6.0.6. I also tried running dnu restore (apparently worked for someone else) from the powershell in the root folder of the project. Same error. Also tried installing via Nugget manager and adding the package name directly in the project.json and letting the VS restore itself.

I am trying to build on dnx451 framework beta8 version.

Does any of the default Framework dependencies require the 6.0.6 version? If so, are there any workarounds to this. I have other projects that requires the latest nugget package and which when referred from the vNext project, throws reference mismatch errors.

Appreciate any help!

1
batman, please add the comment you left on the answer below as an answer. That solved the issue for me and would be helpful for other visitors too. Thanks. - anish

1 Answers

1
votes

You can include Newtonsoft.json 7.0.1. Maybe something wrong with your project.json.

This is my 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" ]
}
}

This is my dnu restore result

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/