Could not load file or assembly 'System.Data.SQLite, Version=1.0.109.0 - Why does it search for version 1.0.109.0 when I have referenced 1.0.109.1

3

I have created new ASP.NET Core Web Application and used ASP.NET Core 2.1 cross platform framework.

Next, I added System.Data.SQLite.Core using Nuget manager. It's the official SQLite database engine for both x86 and x64 along with the ADO.NET provider.

My Main method

    public static void Main(string[] args)
    {
        CreateWebHostBuilder(args).Build().Run();
        SQLiteConnection con = new SQLiteConnection("abc");
    }

When I run the application, it's trying to search for 1.0.109.0 instead of installed 1.0.109.1 version.

So end up throwing below exception as expected

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'System.Data.SQLite, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139'. The system cannot find the file specified. Source=

So, why it's searching for wrong version?

Screenshots for reference

enter image description here

enter image description here

My Solution platform is "Any CPU" and I'm running on a x64 Windows 7 on an x64

Strange

When I do F12 on SQLiteConnection class, it goes to

enter image description here

My .csproj file conent

 <Project Sdk="Microsoft.NET.Sdk.Web">

 <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
     <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>

   <ItemGroup>
      <PackageReference Include="Microsoft.AspNetCore.App" />
      <PackageReference Include="System.Data.SQLite.Core" Version="1.0.109.1" />
    </ItemGroup>

.net
sqlite
asp.net-core
asked on Stack Overflow Aug 29, 2018 by kudlatiger • edited Aug 29, 2018 by kudlatiger

3 Answers

7

I had this exact same issue. What ended up working for me was:

  1. In Windows Explorer, navigate to %UserProfile%\.nuget\packages
  2. Delete the directories for system.data.sqlite.core and system.data.sqlite.core
  3. In your .csproj, change your sqlite package reference to

    `<PackageReference Include="System.Data.SQLite.Core" Version="1.0.109.0"/>`
    
  4. Rebuild the project to restore the package
answered on Stack Overflow Aug 29, 2018 by bmw15
0

I think 1.0.109.0 has been obsolete and no longer available on nuget You can go to

.csproj

Inside ItemGroup

check the version number of system.Data.SQlite.Core. If it is using 1.0.109.0 then replace it with 1.0.109.1

I have a project in which you can see versions are same in both .csproj and references enter image description here

if you are not using visual studio code you can find .csproj file by right click on project and select Open Folder in File Explorer

Since you have version 1.0.109.1 of System.Data.SQLite.Core not System.Data.SQLite

Install-Package System.Data.SQLite -Version 1.0.109.1
answered on Stack Overflow Aug 29, 2018 by TAHA SULTAN TEMURI • edited Aug 29, 2018 by TAHA SULTAN TEMURI
0

I had the same problem on Asp.Net Core 2.0, and the only thing that helped was using 1.0.108.

answered on Stack Overflow Aug 29, 2018 by UweB

User contributions licensed under CC BY-SA 3.0