Update to EF 7.0.0-rc1-final broke SQL DbContextOptionsBuilder UseSqlServer

asp.net-core c# entity-framework entity-framework-core sql-server

Question

I just updated my nuget package to EF 7.0.0-rc1-final from a previous EF 7 version it has broke my sql connection string code.

using System.Collections.Generic;
using ComicEndpoints.Models;
using System.Threading.Tasks;
using Microsoft.Data.Entity;
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
    options.UseSqlServer(@"ConnectionString");
}

The Error:

The Type 'DbContextOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework.Core, Version 7.0.0.0'

I have installed EntityFramework.Core to the latest version in NuGet but I cannot seem to reference it with 'using'. This just occurred when updating to rc1-final and I cannot find any documents referencing the change.

project.JSON

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "EntityFramework.SqlServer": "7.0.0-beta8",
    "EntityFramework.SqlServer.Design": "7.0.0-beta8",
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
    "Newtonsoft.Json": "8.0.1-beta2",
    "EntityFramework.Core": "7.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Hosting --config hosting.ini",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "dnx451": {
      "dependencies": {
        "Microsoft.AspNet.WebApi.Cors": "5.2.3",
        "Microsoft.Owin.Cors": "3.0.1"
      }
    },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ]
}

Popular Answer

I believe the name has also changed on this:

'EntityFramework.SqlServer': "7.0.0-rc1-final'

-- it is now:

'EntityFramework.MicrosoftSqlServer': "7.0.0-rc1-final'

See post: Upgrading ASP.NET 5 Beta 8 to RC1

TIP: Download the Asp.Net Docs from GitHub and see how they (ASP.NET Authors) are coding the references and dependencies...



Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why