Sdk: .NET CLI and frameworks should use the latest version of JSON.NET

Created on 21 Apr 2016  路  7Comments  路  Source: dotnet/sdk

We should be using the latest version of JSON.NET across ASP.NET and .NET Core.
This is required for RC2

Steps to reproduce

Create an ASP.NET Core Web Application
Look at Newtonsoft.Json version in project.lock.json

Expected behavior

      "Microsoft.DotNet.ProjectModel/1.0.0-rc2-002446": {
        "type": "package",
        "dependencies": {
          "Microsoft.CSharp": "4.0.1-rc2-24018",
          "Microsoft.Extensions.DependencyModel": "1.0.0-rc2-002446",
          "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-20459",
          "Newtonsoft.Json": "8.0.x",
}

Microsoft.Extensions.DependencyModel also has 7.0.1 version of JSON.NET

Actual behavior

      "Microsoft.DotNet.ProjectModel/1.0.0-rc2-002446": {
        "type": "package",
        "dependencies": {
          "Microsoft.CSharp": "4.0.1-rc2-24018",
          "Microsoft.Extensions.DependencyModel": "1.0.0-rc2-002446",
          "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-20459",
          "Newtonsoft.Json": "7.0.1",

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-rc2-002392)

Product Information:
Version: 1.0.0-rc2-002392
Commit Sha: 880dcf2fc8

Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64

Most helpful comment

FYI there is a .NET CLI version of Json.NET - https://github.com/JamesNK/Newtonsoft.Json/compare/master...dotnet-cli - but I can't put in on NuGet because the RC2 packages aren't on NuGet.

All 7 comments

@rustd why is this required for RC2? What are you asking to have changed?

Create an ASP.NET Core Web Application

This is not a command supported by CLI. None of the templates generated by CLI reference Newtonsoft.json either. I think you want this change in Visual Studio Tools and should raise the issue in the appropriate repo/store. If you do need CLI changes please reopen and provide more detail.

Currently all the tools that need to read project.json file have a dependency on "Microsoft.DotNet.ProjectModel": "1.0.0-*". As a result all the projects that use these tools need the imports:

"tools": {
  "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
    "version": "1.0.0-*",
    "imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
  }
},

It is not only ugly - people who don't create projects from templates have hard time creating a project.json file that works. Everything seems to be fine until they try to run the tool and they get:

 Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

This has already been reported a few times (e.g. https://github.com/aspnet/IISIntegration/issues/133, https://github.com/aspnet/EntityFramework/issues/5022#issuecomment-209690184) in different repos.

(note that the version of JSON.NET can't be 8.0.3 but the one that contains support for netstandard - not on NuGet yet)

/cc @DamianEdwards

That sounds good. I'm putting this in backlog. Once there is a version that we need to move to, let's move the bug to RC2.

I'm assigning to @rustd to track down the right version of Newtonsoft.Json and push this to RC2 once it's actionable.

There won't be any progress until .NET Core RC2. When it is released I'll create a netstandard build and release a new version of Json.NET.
https://github.com/JamesNK/Newtonsoft.Json/issues/618

So it looks like this wont make rc2 :disappointed:

FYI there is a .NET CLI version of Json.NET - https://github.com/JamesNK/Newtonsoft.Json/compare/master...dotnet-cli - but I can't put in on NuGet because the RC2 packages aren't on NuGet.

//cc @davidfowl

We are not directly depending on JSON.NET anymore.

Was this page helpful?
0 / 5 - 0 ratings