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
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
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>
I had this exact same issue. What ended up working for me was:
%UserProfile%\.nuget\packages
system.data.sqlite.core
and system.data.sqlite.core
In your .csproj
, change your sqlite package reference to
`<PackageReference Include="System.Data.SQLite.Core" Version="1.0.109.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
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
I had the same problem on Asp.Net Core 2.0, and the only thing that helped was using 1.0.108.
User contributions licensed under CC BY-SA 3.0