Database first migration EF Core

c# entity-framework entity-framework-core

Question

I am trying to migrate the NORTWIND database to a test project with EF Core. I have with the help of the web overcome sevrel obstaclesbut but as of right now I am stuck. So I would be very pleased if someone out there could shed some light on my problem. Perhaps point me in the right direction.

Problem: When I run:

Scaffold-DbContext "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=NORTHWND;Integrated Security=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

in the Package Manager Console in VS I get the message Build Error. I cant pinpoint the problem so I have a hard time searching for a solutions on the web.

This is my project.Json:

 "dependencies": {
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
"BundlerMinifier.Core": "2.2.306",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0"
  },

 "tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"
  },

This is the error I get:

enter image description here

This is the Error code:

enter image description here

Tell me if there is something else you want to se from my project. I know it can perhaps be hard to give help from the information I have provided. But I will gladly post more info. Just tell me what you want to see.

Thanks for all the help and hints!

1
3
12/19/2016 12:49:26 PM

Accepted Answer

Hello and Thanks to everybody for all the help. Finally imported a database. The things that did it was to Update the solution thru the NuGet package manager for the solution and adding these line to the dependencies:

"Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },

   "runtimes": { "win10-x64": {} },

Once again Thanks to all for your suggestions!!!! How do you place the chechmark on multiple answers? Becasue everybodys answers finally made me solve the problem.

0
12/20/2016 8:56:40 PM

Popular Answer

The link below shows the step-by-step procedure. I had some problems with VS 2017 RC resolved by updating all packages with the -pre option and installing dotnet core 1.1 on the PC.

https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db

;-)



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