title: Type Load Exception in EF Core Project
body: <p>I have an ASP.NET Core 3.1 Web API application using EF Core. This is the my configuration in the <code>ConfigureServices</code> method of the <code>Startup</code> class:</p>
  <pre><code>services.AddDbContext&lt;ApplicationContext&gt;(options =&gt;
  options.UseSqlServer(Configuration.GetConnectionString(&quot;AppConn&quot;)));
  </code></pre>
  <p>The above configuration tested and works for a SQL Server database.</p>
  <p>Then I switched to using Sqlite after installing its package successfully.</p>
  <pre><code>services.AddDbContext&lt;ApplicationContext&gt;(options =&gt;
       options.UseSqlite(&quot;Data Source=sqlitedemo.db&quot;));
  </code></pre>
  <p>But when I try to add the EF migration</p>
  <pre><code>add-migration initial -context ApplicationContext
  </code></pre>
  <p>I get this error:</p>
  <blockquote>
  <p>System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.</p>
  <p>System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.SemanticVersionComparer' from assembly 'Microsoft.EntityFrameworkCore, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.</p>
  <p>{ Stack trace }</p>
  <p>Exception has been thrown by the target of an invocation.</p>
  </blockquote>