'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer'
<p>I am trying to create a Web API in VS 2015 Pro (Update 3) using C# and targeting .NET Core.</p>
<p>I am following <a href="https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html#install-entity-framework" rel="nofollow noreferrer">this tutorial</a>.
However, I am connecting to a MySQL database instead of an SQL Server database - not sure how much difference that makes...</p>
<p>Anyway, in the tutorial, I have to <em>&quot;Register my context with dependency injection&quot;</em> - so I have to add the following line to the <strong>ConfigureServices</strong> section of the <strong>Startup.cs</strong> file:</p>
<pre><code>var connection = Configuration.GetConnectionString(&quot;DefaultConnection&quot;);
services.AddDbContext&lt; Models.PropWorxContext &gt; (options =&gt; options.UseSqlServer(connection));;
</code></pre>
<p>However, VS gives me the following error:</p>
<p><em>Error CS1061 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer' and no extension method 'UseSqlServer' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?)</em></p>
<p>Any ideas why?</p>
<p>This is what the whole Startup.cs file looks like:</p>
<pre><code>using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace PropWorxAPI
{
    public class Startup
    {
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                .SetBasePath(env.ContentRootPath)
                .AddJsonFile(&quot;appsettings.json&quot;, optional: true, reloadOnChange: true)
                .AddJsonFile($&quot;appsettings.{env.EnvironmentName}.json&quot;, optional: true)
                .AddEnvironmentVariables();
            Configuration = builder.Build();
        }

        public IConfigurationRoot Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();

            var connection = Configuration.GetConnectionString(&quot;DefaultConnection&quot;);
            services.AddDbContext&lt; Models.PropWorxContext &gt; (options =&gt; options.UseSqlServer(connection));
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection(&quot;Logging&quot;));
            loggerFactory.AddDebug();

            app.UseMvc();
        }
    }
}
</code></pre>
<p>I have also added the MySQL package using the Package Manager, so that my <strong>project.json</strong> file contains this entry:</p>
<pre><code>*&quot;MySql.Data.EntityFrameworkCore&quot;: &quot;7.0.6-IR31&quot;*
</code></pre>
<p>Any hints as to where I've gone wrong would be greatly appreciated, as I've spent all day trying to figure it out :( Thank you...</p>