title: EF Core 'Cannot Load Assembly' error when scaffolding
body: <p>I am unsure why I am getting the error, especially since I am able to add migrations and update the database using a code first approach. It is only now that I am attempting to scaffold a new database that  I am getting the error.</p>
  <p>Lairage.Blazor - Startup.cs</p>
  <pre><code>// Add the Innova Connection
  services.AddContext&lt;InnovaContext&gt;(Configuration.GetConnectionString(&quot;InnovaConnection&quot;));
  </code></pre>
  <p>Lairage.Context.Sql - ServiceCollectionExtentions</p>
  <pre><code>public static class ServiceCollectionExtentions
  {
          
          public static IServiceCollection AddContext&lt;TContext&gt;(this IServiceCollection services, string connectionstring, ServiceLifetime serviceLifetime = ServiceLifetime.Scoped) where TContext : DbContext =&gt; services
              .AddDbContext&lt;TContext&gt;(options =&gt; options.UseSqlServer(
                      connectionstring,
                      actions =&gt; actions.MigrationsAssembly(&quot;Lairage.Context.Sql&quot;)
                                        .EnableRetryOnFailure()
                  ), serviceLifetime);
  
  }
  </code></pre>
  <p>Error:</p>
  <blockquote>
  <p>Could not load assembly 'Lairage.Context.Sql'. Ensure it is referenced by the startup project 'Lairage.Blazor'.</p>
  </blockquote>
  <p>Package Manager Default Class:</p>
  <p>I have my Package Manager setup to the default project <strong>Lairage.Context.Sql</strong>.</p>
  <p>Command:</p>
  <pre><code>Scaffold-DbContext &quot;Server=&lt;***&gt;;Initial Catalog=&lt;***&gt;;MultipleActiveResultSets=true;Integrated Security=True;&quot; Microsoft.EntityFrameworkCore.SqlServer -OutputDir Innova
  </code></pre>