title: 'This is the 'bait'. You probably need to add one of the SQLitePCLRaw.bundle_* nuget packages
body: <p>I am using Entity Framework Core 2 in my application using SQLite as my database provider.</p>
  
  <p>I have added references to the following in my project:</p>
  
  <ul>
  <li>Microsoft.EntityFrameworkCore</li>
  <li>Microsoft.EntityFrameworkCore.Sqlite.Core</li>
  <li>Microsoft.Data.Sqlite</li>
  <li>SQLitePCLRaw.batteries_green</li>
  <li>SQLitePCLRaw.batteries_v2</li>
  <li>SQLitePCLRaw.core</li>
  <li>SQLitePCLRaw.provider.e_sqlite3</li>
  </ul>
  
  <p>I am trying to use the <code>IMigrator</code> on my dbcontext to setup my initial database like so:</p>
  
  <pre><code>using (var dbContext = new DbContext())
  {
      var migrator = dbContext.GetInfrastructure().GetRequiredService&lt;IMigrator&gt;();
      migrator.Migrate();
  } 
  </code></pre>
  
  <p>In my <code>DbContext</code> I am setting adding the service with:</p>
  
  <pre><code>options.UseSqlite(connectionString); 
  </code></pre>
  
  <p>My connection string is just a local path.</p>
  
  <p>This all seems like what I should be doing as per Microsoft's documentation. However when I try to run my application, I get the following error:</p>
  
  <blockquote>
    <p>'This is the 'bait'.  You probably need to add one of the
    SQLitePCLRaw.bundle_* nuget packages to your platform project.'</p>
  </blockquote>
  
  <p>As far as I'm aware I have added a <code>SQLitePCLRaw.bundle_*</code> package since I am referencing both <code>SQLitePCLRaw.batteries_green</code> and <code>SQLitePCLRaw.batteries_v2</code>.</p>
  
  <p>Does anyone know of a way to fix this error and use SQLite as my database provider?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>My Data project .csproj (slightly redacted):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /&gt;
    &lt;PropertyGroup&gt;
      &lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt;
      &lt;Platform Condition=" '$(Platform)' == '' "&gt;AnyCPU&lt;/Platform&gt;
      &lt;ProjectGuid&gt;{EA5DB634-7838-4C96-8DF5-4051B31DFFD2}&lt;/ProjectGuid&gt;
      &lt;OutputType&gt;Library&lt;/OutputType&gt;
      &lt;AppDesignerFolder&gt;Properties&lt;/AppDesignerFolder&gt;
      &lt;RootNamespace&gt;Data&lt;/RootNamespace&gt;
      &lt;AssemblyName&gt;Data&lt;/AssemblyName&gt;
      &lt;TargetFrameworkVersion&gt;v4.6.1&lt;/TargetFrameworkVersion&gt;
      &lt;FileAlignment&gt;512&lt;/FileAlignment&gt;
    &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "&gt;
      &lt;DebugSymbols&gt;true&lt;/DebugSymbols&gt;
      &lt;DebugType&gt;full&lt;/DebugType&gt;
      &lt;Optimize&gt;false&lt;/Optimize&gt;
      &lt;OutputPath&gt;..\Build\Debug\bin\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;DEBUG;TRACE&lt;/DefineConstants&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
      &lt;PlatformTarget&gt;x64&lt;/PlatformTarget&gt;
    &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "&gt;
      &lt;DebugType&gt;pdbonly&lt;/DebugType&gt;
      &lt;Optimize&gt;true&lt;/Optimize&gt;
      &lt;OutputPath&gt;..\Build\Release\bin\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;TRACE&lt;/DefineConstants&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
      &lt;PlatformTarget&gt;x64&lt;/PlatformTarget&gt;
    &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"&gt;
      &lt;DebugSymbols&gt;true&lt;/DebugSymbols&gt;
      &lt;OutputPath&gt;..\Build\Debug\bin\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;DEBUG;TRACE&lt;/DefineConstants&gt;
      &lt;DebugType&gt;full&lt;/DebugType&gt;
      &lt;PlatformTarget&gt;x64&lt;/PlatformTarget&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;CodeAnalysisRuleSet&gt;MinimumRecommendedRules.ruleset&lt;/CodeAnalysisRuleSet&gt;
    &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"&gt;
      &lt;OutputPath&gt;..\Build\Release\bin\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;TRACE&lt;/DefineConstants&gt;
      &lt;Optimize&gt;true&lt;/Optimize&gt;
      &lt;DebugType&gt;pdbonly&lt;/DebugType&gt;
      &lt;PlatformTarget&gt;x64&lt;/PlatformTarget&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;CodeAnalysisRuleSet&gt;MinimumRecommendedRules.ruleset&lt;/CodeAnalysisRuleSet&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;Reference Include="Microsoft.Data.Sqlite"&gt;
        &lt;HintPath&gt;..\References\Microsoft.Data.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="Microsoft.EntityFrameworkCore"&gt;
        &lt;HintPath&gt;..\References\Microsoft.EntityFrameworkCore.2.0.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="Microsoft.EntityFrameworkCore.Relational"&gt;
        &lt;HintPath&gt;..\References\Microsoft.EntityFrameworkCore.Relational.2.0.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Relational.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="Microsoft.EntityFrameworkCore.Sqlite.Core"&gt;
        &lt;HintPath&gt;..\References\Microsoft.EntityFrameworkCore.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Sqlite.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="Microsoft.EntityFrameworkCore.SqlServer"&gt;
        &lt;HintPath&gt;..\References\Microsoft.EntityFrameworkCore.SqlServer.2.0.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.SqlServer.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="SQLitePCLRaw.batteries_green, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL"&gt;
        &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
        &lt;HintPath&gt;..\References\SQLitePCLRaw.bundle_green.1.1.7\lib\net45\SQLitePCLRaw.batteries_green.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="SQLitePCLRaw.batteries_v2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL"&gt;
        &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
        &lt;HintPath&gt;..\References\SQLitePCLRaw.bundle_green.1.1.7\lib\net45\SQLitePCLRaw.batteries_v2.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL"&gt;
        &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
        &lt;HintPath&gt;..\References\SQLitePCLRaw.core.1.1.7\lib\net45\SQLitePCLRaw.core.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9c301db686d0bd12, processorArchitecture=MSIL"&gt;
        &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
        &lt;HintPath&gt;..\References\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.7\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System" /&gt;
      &lt;Reference Include="System.Collections.Immutable, Version=1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"&gt;
        &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
        &lt;HintPath&gt;..\References\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.ComponentModel.Annotations"&gt;
        &lt;HintPath&gt;..\References\System.ComponentModel.Annotations.4.4.0\lib\netstandard2.0\System.ComponentModel.Annotations.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Configuration" /&gt;
      &lt;Reference Include="System.Data" /&gt;
      &lt;Reference Include="System.Data.SQLite, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=AMD64"&gt;
        &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
        &lt;HintPath&gt;..\References\System.Data.SQLite.1.0.104.0\System.Data.SQLite.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Interactive.Async, Version=3.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"&gt;
        &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
        &lt;HintPath&gt;..\References\System.Interactive.Async.3.1.1\lib\netstandard1.3\System.Interactive.Async.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Data.DataSetExtensions" /&gt;
      &lt;Reference Include="Microsoft.CSharp" /&gt;
      &lt;Reference Include="System.Xml" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;Compile Include="Sqlite\SqliteDbConnectionFactory.cs" /&gt;
    &lt;/ItemGroup&gt;
    &lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>My DbContext is in a different project that references my Data project. The <code>SqliteDbConnectionFactory</code> sets up the <code>UseSqlite</code> on the <code>DbContextOptionsBuilder</code> from an <code>OnConfiguring</code> override in my DbContext.</p>