title: Using Entity Framework Core migrations for class library project
body: <p>This seem to be <a href="https://github.com/aspnet/EntityFrameworkCore/issues/5320" rel="noreferrer">an issue that have been fixed already</a>, at least for the SQLite databases.</p>
  
  <p>My solution consists of 3 projects:</p>
  
  <ol>
  <li>WPF project (default startup project) (<strong>.NET Framework 4.7</strong>),</li>
  <li>"Core" project holding the view model and non-UI stuff - Class library project (<strong>.NET Standard 2.0</strong>)</li>
  <li>"Relational" project holding all of the Entity Framework data layer - I like to keep those separated (<strong>.NET Standard 2.0</strong>)</li>
  </ol>
  
  <p>I have installed the following packages into the main WPF project:</p>
  
  <pre><code>Microsoft.EntityFrameworkCore.Tools
  Microsoft.EntityFrameworkCore.Design
  </code></pre>
  
  <p>Projects 2 and 3 are referenced in my main WPF project. So basically, it should be enough for the EF to resolve the DbContextes.</p>
  
  <p>However, it's not - as running <code>Add-Migration</code> on my WPF project results in:</p>
  
  <pre><code>PM&gt; Add-Migration "Initial"
  No DbContext was found in assembly 'TestWPFProject'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
  </code></pre>
  
  <p>Switching to project <code>3</code> as default in the Package Manager Console results in:</p>
  
  <pre><code>PM&gt; Add-Migration "Initial"
  Unable to create an object of type 'ClientDbContext'. Add an implementation of 'IDesignTimeDbContextFactory&lt;ClientDataStoreDbContext&gt;' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.
  </code></pre>
  
  <p><strong>How can I properly use EF Core migrations with my class library project and WPF project?</strong></p>