Invalid JSON file project.json

asp.net asp.net-core entity-framework-core

Question

I am new in entity framework core and I want to use entity framework core in asp.net core. But when I do add-migration firstMigration it always show below error :

Invalid JSON file in D:\OwnLearnings\EFCore\AspNetCore_EFCore_001\src\AspNetCore_EFCore_001\project.json

Project.json :

 {
   "dependencies": {
   "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
   "Microsoft.AspNetCore.Diagnostics": "1.0.0",
   "Microsoft.AspNetCore.Mvc": "1.0.1",
   "Microsoft.AspNetCore.Razor.Tools": {
     "version": "1.0.0-preview2-final",
     "type": "build"
   },
   "Microsoft.AspNetCore.Routing": "1.0.1",
   "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
   "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
   "Microsoft.AspNetCore.StaticFiles": "1.0.0",

   "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
   "Microsoft.EntityFrameworkCore.Tools": {
     "version": "1.0.0-preview2-final",
     "type": "build"
    },


    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
     "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
    },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
  },

 "frameworks": {
"netcoreapp1.0": {
  "imports": [
    "dotnet5.6",
    "portable-net45+win8"
  ]
}
},

 "buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},

 "runtimeOptions": {
"configProperties": {
  "System.GC.Server": true
}
    },

 "publishOptions": {
"include": [
  "wwwroot",
  "**/*.cshtml",
  "appsettings.json",
  "web.config"
]
    },

 "scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
   }

I unable to find what is the error. I am facing this type of problem first time in entity framework. Thanks in advance.

1
0
4/16/2017 11:03:21 AM

Popular Answer

Are you missing a reference to the Entity framework package in the dependencies:

"Microsoft.EntityFrameworkCore": "1.0.0"

Also you need the imports for EF Core for executing migrations and updates (command line). This needs to be in the tools seciton (the tools reference also needs to be in the dependencies like you put it, do not remove it)

"dependencies": {
...   
},
"tools": {
    ..,
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "Imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
}...
0
4/16/2017 12:25:01 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow