EF Core 1.1 Migration - The current CSharpHelper cannot scaffold literals of type

前端 未结 1 1050
灰色年华
灰色年华 2020-12-12 02:14

This seems to be a really obscure error, and I don\'t even know where to start with it...

The current CSharpHelper cannot scaffold literals of type

相关标签:
1条回答
  • 2020-12-12 03:03

    You are using a .NET Core 1.1 runtime but the old tooling packages (you should be using the latest tooling, as of this date it is preview4, which is still in alpha, contrary to the runtime - yeah, not very intuitive at first)

    In summary, this is a Known Issue

    • Update your project.json to use preview4 as stated in Announcing Entity Framework Core 1.1

    "tools": {
        "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4"
    }
    
    • You may, or may not need to fix the SDK version by using a global.json just above the src folder which should contain your code as explained in Hanselman's blog

    {
      "projects": [ "src", "test" ],
      "sdk": {
        "version": "1.0.0-preview2-1-003177"
      }
    }
    

    EDIT: Just to give you a more complete answer, this is how my project.json and my sample project looks like (all done in VS Code):

    {
      "version": "1.0.0-*",
      "buildOptions": {
        "debugType": "portable",
        "emitEntryPoint": true
      },
      "dependencies": {
        "Microsoft.EntityFrameworkCore": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.Design": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0-preview1-final",
      },
      "frameworks": {
        "netcoreapp1.1": {
          "dependencies": {
            "Microsoft.NETCore.App": {
              "type": "platform",
              "version": "1.1.0"
            }
          },
          "imports": "dnxcore50"
        }
      },
      "tools": {
        "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
      }
    }
    

    0 讨论(0)
提交回复
热议问题