title: Dependency-injection Exception when configuring EntityFramework Core
body: <pre><code>//the Startup.cs file configuration settings.
  public void ConfigureServices(IServiceCollection services)
  {
      services.AddMvc();
      services.AddEntityFramework().AddSqlServer().AddDbContext&lt;PortContext&gt;();
  }
  </code></pre>
  
  <p><strong>project.json</strong></p>
  
  <pre><code> {
    "dependencies": {
    "Microsoft.NETCore.App": {
    "version": "1.0.0",
    "type": "platform"
   },
    "Microsoft.EntityFrameworkCore.Design": {
    "version": "1.0.0-*",
    "type": "build"
   },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "MailKit": "1.3.0-beta7",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "EntityFramework.Core": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "mongocsharpdriver": "2.3.0-rc1",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
   },
  
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Razor.Tools": {
    "version": "1.0.0-preview1-final",
    "imports": "portable-net45+win8+dnxcore50"
  },
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-*"
  },
  "commands": {
  "ef": "EntityFramework.Commands"
  },
  "frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "dotnet5.6",
      "portable-net45+win8"
    ]
   }
  },
  
   "buildOptions": {
   "emitEntryPoint": true,
   "preserveCompilationContext": true
  },
  
  "runtimeOptions": {
   "configProperties": {
     "System.GC.Server": true
   }
  },
  
  "publishOptions": {
   "include": [
     "wwwroot",
     "web.config"
   ]
  },
  
  "scripts": {
  "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
   }
  }
  
      And my PortContext.cs file's OnConfiguring method is given below.
  
      protected override void OnConfiguring(DbContextOptionsBuilder options)
      {
          var connString =Startup.Configuration["Data:PortContextConnection"];
          options.UseSqlServer(connString);
          base.OnConfiguring(options);
      }
  </code></pre>
  
  <p>When I run <code>dotnet ef migrations add</code> command I am getting the exception:</p>
  
  <blockquote>
    <p>An error occurred while calling method 'ConfigureServices' on startup class 'WebApplication8.Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Error: Could not load type 'Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions' from assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.</p>
  </blockquote>
  
  <p>Can anyone help me solve this issue?</p>