title: Unable to create an object of type 'GameContext'
body: <p>I have created an asp.net core project, And also i have created one ClassLibrary and i have joined them to one solution.
  I write my way step by step :</p>
  <p>1-<code>dotnet new sln</code>
  2-<code>dotnet new mvc -o GameShop</code>
  3-<code>dotnet new classlib -o GameShop.Data</code>
  Then i created a class in GameShop.Data/Domain/User, I named it &quot;User.cs&quot;</p>
  <pre><code>using System;
  using System.ComponentModel.DataAnnotations;
  using System.ComponentModel.DataAnnotations.Schema;
  
  namespace GameShop.Data.Domain.User
  {
      public class User
      {
            [Key]
          public int UserId { get; set; }
          [Display(Name = &quot;نام کاربری&quot;)]
          [Required(ErrorMessage = &quot;لطفا {0} را وارد کنید&quot;)]
          [MaxLength(200, ErrorMessage = &quot;{0} نمی تواند بیشتر از {1} باشد&quot;)]
          public string UserName { get; set; }
          [Display(Name = &quot;ایمیل&quot;)]
          [Required(ErrorMessage = &quot;لطفا {0} را وارد کنید&quot;)]
          [MaxLength(400, ErrorMessage = &quot;{0} نمی تواند بیشتر از {1} باشد&quot;)]
          [EmailAddress(ErrorMessage = &quot;ایمیل وارد شده معتبر نمی باشد&quot;)]
          public string Email { get; set; }
  
          [Display(Name = &quot;کلمه عبور&quot;)]
          [Required(ErrorMessage = &quot;لطفا {0} را وارد کنید&quot;)]
          [MaxLength(200, ErrorMessage = &quot;{0} نمی تواند بیشتر از {1} باشد&quot;)]
          public string Password { get; set; }
  
          [Display(Name = &quot;تاریخ ثبت نام&quot;)]
          public DateTime RegisterDate { get; set; }
          [Display(Name = &quot;کد فعال سازی&quot;)]
          public string ActiveCode { get; set; }
  
         
  
      }
  }
  </code></pre>
  <p>This is my startup :</p>
  <pre><code> public void ConfigureServices(IServiceCollection services)
          {
              services.AddControllersWithViews();
               services.AddDbContext&lt;GameContext&gt;(option =&gt;
              {
                  option.UseSqlServer(Configuration.GetConnectionString(&quot;GameShop&quot;));
              });
          }
  </code></pre>
  <p>This my ConnectionString :</p>
  <pre><code>{
    &quot;ConnectionStrings&quot;: {
      &quot;GameShop&quot;: &quot;Data Source=.;Initial Catalog=GameShop-DB;Integrated Security=True&quot;
    }
  </code></pre>
  <p>And this is my Context that its address is :(GameShop.Data/Context/GameContext)</p>
  <pre><code>using System;
  using Microsoft.EntityFrameworkCore;
  using GameShop.Data.Domain.User;
  
  namespace GameShop.Data.Context
  {
      public class GameContext:DbContext
      {
          public GameContext(DbContextOptions&lt;GameContext&gt; option):base(option)
          {
              
          }
          public DbSet&lt;User&gt; Users { get; set; }
          
      }
  }
  </code></pre>
  <p>Thats my codes. But whn i want to &quot;add migrations&quot;, i have an error that says : Unable to create an object of type 'GameContext'. For the different patterns supported at design time, see <a href="https://go.microsoft.com/fwlink/?linkid=851728" rel="nofollow noreferrer">https://go.microsoft.com/fwlink/?linkid=851728</a></p>
  <p>These are the packages that i have in both GameShop.csproj and Gameshop.csproj :</p>
  <pre><code>&lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore&quot; Version=&quot;5.0.3&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Design&quot; Version=&quot;5.0.3&quot;&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.SqlServer&quot; Version=&quot;5.0.3&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Tools&quot; Version=&quot;5.0.3&quot;&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Tools.DotNet&quot; Version=&quot;2.0.3&quot; /&gt;
       &lt;PackageReference Include=&quot;Microsoft.VisualStudio.Web.CodeGeneration.Design&quot; Version=&quot;5.0.2&quot; /&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  <p>(I tried this without any ClassLibrary(just one &quot;asp.net core mvc project &quot;) and i didn`t have any error)</p>
  <p>So can anyone help me what to do ???</p>