4

I am using Microsoft.EntityFrameworkCore.Sqlite version 2.2.4 Microsoft.EntityFrameworkCore version 2.2.4 nuget packages on my .net core class library.

When adding my class library to Console application I am getting the following exception: FileNotFoundException: Could not load file or assembly 'SQLitePCLRaw.core, Version=1.1.12.351, Culture=neutral, PublicKeyToken=1488e028ca7ab535'. The system cannot find the file specified.

My code is running on windows but will also run on Linux.

Is there any solution?

I saw a recommendation for adding Microsoft.EntityFrameworkCore.Sqlite nuget to my console application. but I prefer avoiding this solution.

user1551454
  • 111
  • 1
  • 7
  • 2
    Try adding a reference to Microsoft.Data.Sqlite package, and calling `Batteries.Init();` at the start of your program. – Lasse V. Karlsen May 16 '19 at 14:15
  • After adding Microsoft.Data.Sqlite and calling Batteries.Init(), I am getting new error: Could not load file or assembly 'SQLitePCLRaw.batteries_green, Version=1.1.12.351, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f'. The system cannot find the file specified.' – user1551454 May 16 '19 at 19:44
  • Call Batteries.Init() solved my problem too. Took one day to find this post! But you need this package. SQLitePCLRaw.bundle_green – Egbert Nierop Nov 24 '19 at 18:22

1 Answers1

2

i just faced same problem and doing these steps solve it

  1. remove obj and bin folder
  2. run dotnet restore --force
sajjad kalantari
  • 568
  • 5
  • 23