title: EF Core: Update-Database command not creating user tables
body: <p>Following <a href="https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db" rel="nofollow noreferrer">this tutorial</a> I created an <code>ASP.NET Core 1.1.1 - Code first</code> app on <code>VS2017 ver 15.3.3</code>. The only difference between the tutorial and my app is that I chose <code>Individual User Accounts</code> option and I'm using <code>SQL Server 2012 EXPRESS</code> Db instead of LocalDb. Following commands run fine and do create Blogging database with Blogs and Posts tables. Note: I've not upgraded to .NET Core 2.0 yet on both the computers for compatibility issues with some of our existing applications.</p>
  
  <pre><code>PM&gt; Add-Migration myFirstMigration -context BloggingContext
  PM&gt; Update-Database -context BloggingContext
  </code></pre>
  
  <p><strong>ISSUE</strong></p>
  
  <p>But when I run the following command to generate user tables (ASPNETUsers, ASPNETRols etc) the command runs without any error but the user tables are not created. This was not happening before I upgraded VS2017 to ver 15.3.3. Also, on my other computer (Windows 10 with SQLEXPRESS 2014) I don't have such a problem. This computer is Windows 7. What could possibly be the issue here - and what I may be missing here?</p>
  
  <pre><code>Update-Database -context BloggingContext
  </code></pre>
  
  <p><strong>.csproj file</strong></p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp1.1&lt;/TargetFramework&gt;
      &lt;PackageTargetFallback&gt;$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;&lt;/PackageTargetFallback&gt;
      &lt;UserSecretsId&gt;aspnet-ForgotPassword-B181AA40-BA34-4A36-A650-38857D8E8177&lt;/UserSecretsId&gt;
    &lt;/PropertyGroup&gt;
  
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.1" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.2" /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.1" /&gt;
      &lt;DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.1" /&gt;
      &lt;DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>
  
  <p><strong>ApplicationDbContextModelShapshot.cs</strong></p>
  
  <pre><code>[DbContext(typeof(ApplicationDbContext))]
  partial class ApplicationDbContextModelSnapshot : ModelSnapshot
  {
      protected override void BuildModel(ModelBuilder modelBuilder)
      {
          modelBuilder
              .HasAnnotation("ProductVersion", "1.0.0-rc3")
              .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =&gt;
              {
                  b.Property&lt;string&gt;("Id");
  
                  b.Property&lt;string&gt;("ConcurrencyStamp")
                      .IsConcurrencyToken();
  
                  b.Property&lt;string&gt;("Name")
                      .HasAnnotation("MaxLength", 256);
  
                  b.Property&lt;string&gt;("NormalizedName")
                      .HasAnnotation("MaxLength", 256);
  
                  b.HasKey("Id");
  
                  b.HasIndex("NormalizedName")
                      .HasName("RoleNameIndex");
  
                  b.ToTable("AspNetRoles");
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim&lt;string&gt;", b =&gt;
              {
                  b.Property&lt;int&gt;("Id")
                      .ValueGeneratedOnAdd();
  
                  b.Property&lt;string&gt;("ClaimType");
  
                  b.Property&lt;string&gt;("ClaimValue");
  
                  b.Property&lt;string&gt;("RoleId")
                      .IsRequired();
  
                  b.HasKey("Id");
  
                  b.HasIndex("RoleId");
  
                  b.ToTable("AspNetRoleClaims");
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim&lt;string&gt;", b =&gt;
              {
                  b.Property&lt;int&gt;("Id")
                      .ValueGeneratedOnAdd();
  
                  b.Property&lt;string&gt;("ClaimType");
  
                  b.Property&lt;string&gt;("ClaimValue");
  
                  b.Property&lt;string&gt;("UserId")
                      .IsRequired();
  
                  b.HasKey("Id");
  
                  b.HasIndex("UserId");
  
                  b.ToTable("AspNetUserClaims");
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin&lt;string&gt;", b =&gt;
              {
                  b.Property&lt;string&gt;("LoginProvider");
  
                  b.Property&lt;string&gt;("ProviderKey");
  
                  b.Property&lt;string&gt;("ProviderDisplayName");
  
                  b.Property&lt;string&gt;("UserId")
                      .IsRequired();
  
                  b.HasKey("LoginProvider", "ProviderKey");
  
                  b.HasIndex("UserId");
  
                  b.ToTable("AspNetUserLogins");
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole&lt;string&gt;", b =&gt;
              {
                  b.Property&lt;string&gt;("UserId");
  
                  b.Property&lt;string&gt;("RoleId");
  
                  b.HasKey("UserId", "RoleId");
  
                  b.HasIndex("RoleId");
  
                  b.HasIndex("UserId");
  
                  b.ToTable("AspNetUserRoles");
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken&lt;string&gt;", b =&gt;
              {
                  b.Property&lt;string&gt;("UserId");
  
                  b.Property&lt;string&gt;("LoginProvider");
  
                  b.Property&lt;string&gt;("Name");
  
                  b.Property&lt;string&gt;("Value");
  
                  b.HasKey("UserId", "LoginProvider", "Name");
  
                  b.ToTable("AspNetUserTokens");
              });
  
          modelBuilder.Entity("ForgotPassword.Models.ApplicationUser", b =&gt;
              {
                  b.Property&lt;string&gt;("Id");
  
                  b.Property&lt;int&gt;("AccessFailedCount");
  
                  b.Property&lt;string&gt;("ConcurrencyStamp")
                      .IsConcurrencyToken();
  
                  b.Property&lt;string&gt;("Email")
                      .HasAnnotation("MaxLength", 256);
  
                  b.Property&lt;bool&gt;("EmailConfirmed");
  
                  b.Property&lt;bool&gt;("LockoutEnabled");
  
                  b.Property&lt;DateTimeOffset?&gt;("LockoutEnd");
  
                  b.Property&lt;string&gt;("NormalizedEmail")
                      .HasAnnotation("MaxLength", 256);
  
                  b.Property&lt;string&gt;("NormalizedUserName")
                      .HasAnnotation("MaxLength", 256);
  
                  b.Property&lt;string&gt;("PasswordHash");
  
                  b.Property&lt;string&gt;("PhoneNumber");
  
                  b.Property&lt;bool&gt;("PhoneNumberConfirmed");
  
                  b.Property&lt;string&gt;("SecurityStamp");
  
                  b.Property&lt;bool&gt;("TwoFactorEnabled");
  
                  b.Property&lt;string&gt;("UserName")
                      .HasAnnotation("MaxLength", 256);
  
                  b.HasKey("Id");
  
                  b.HasIndex("NormalizedEmail")
                      .HasName("EmailIndex");
  
                  b.HasIndex("NormalizedUserName")
                      .IsUnique()
                      .HasName("UserNameIndex");
  
                  b.ToTable("AspNetUsers");
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim&lt;string&gt;", b =&gt;
              {
                  b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
                      .WithMany("Claims")
                      .HasForeignKey("RoleId")
                      .OnDelete(DeleteBehavior.Cascade);
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim&lt;string&gt;", b =&gt;
              {
                  b.HasOne("ForgotPassword.Models.ApplicationUser")
                      .WithMany("Claims")
                      .HasForeignKey("UserId")
                      .OnDelete(DeleteBehavior.Cascade);
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin&lt;string&gt;", b =&gt;
              {
                  b.HasOne("ForgotPassword.Models.ApplicationUser")
                      .WithMany("Logins")
                      .HasForeignKey("UserId")
                      .OnDelete(DeleteBehavior.Cascade);
              });
  
          modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole&lt;string&gt;", b =&gt;
              {
                  b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
                      .WithMany("Users")
                      .HasForeignKey("RoleId")
                      .OnDelete(DeleteBehavior.Cascade);
  
                  b.HasOne("ForgotPassword.Models.ApplicationUser")
                      .WithMany("Roles")
                      .HasForeignKey("UserId")
                      .OnDelete(DeleteBehavior.Cascade);
              });
      }
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I tried the above test by selecting ASP.NET Core 2.0 template on another computer that has <code>.NET Core 2.0</code> and <code>VS2017 ver 15.3.3</code> and everything worked fine as expected - with same SQL Server version <code>SQLEXPRESS2012</code>. Blogging Db was created with Blogs and Posts tables and user tables ASPNETUsers, ASPNETRoles etc. So problem seems to be when you have .NET Core 1.1.1 on your system with <code>VS2017 ver 15.3.3</code> and your are trying to create an ASP.NET Core 1.1.1 web app with <code>Individual User Accounts</code> then <code>ApplicationDbContext</code> does not work.</p>