SQLite Library (x86, x64, ARM and ARM64) for UWP (Universal Windows Platform)
$ dotnet add package SQLite3.UniversalA comprehensive SQLite library for Universal Windows Platform (UWP) applications, providing native SQLite support for x86, x64, ARM, and ARM64 architectures.
Replace Visual Studio SQLite Extension - This NuGet package is designed as a drop-in replacement for the SQLite for Universal Windows Platform Visual Studio extension.
If you're currently using the Visual Studio SQLite extension:
Install-Package SQLite3.UniversalNo code changes required - your existing SQLite code will work unchanged.
using SQLite;
using System.IO;
using Windows.Storage;
// Define your data model
public class Person
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[MaxLength(50)]
public string Name { get; set; }
public int Age { get; set; }
}
// Initialize database connection
var databasePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "MyDatabase.db");
var connection = new SQLiteConnection(databasePath);
// Create table
connection.CreateTable<Person>();
// Insert data
var person = new Person { Name = "John Doe", Age = 30 };
connection.Insert(person);
// Query data
var people = connection.Table<Person>().Where(p => p.Age > 25).ToList();
var connectionString = new SQLiteConnectionString(
databasePath,
false // storeDateTimeAsTicks
);
var connection = new SQLiteConnectionWithLock(
connectionString,
SQLiteOpenFlags.ReadWrite |
SQLiteOpenFlags.Create |
SQLiteOpenFlags.FullMutex |
SQLiteOpenFlags.SharedCache
);
Clone the repository:
git clone https://github.com/danny8002/SQLite3.Universal.git
cd SQLite3.Universal
Open the solution:
start SQLite3.Universal.sln
Build for all platforms:
Releasex86, x64, ARM, and ARM64 platformsBuild/{Platform}/Release/Package NuGet (optional):
cd NuGet
nuget.exe pack package.nuspec
To upgrade to a newer SQLite version from the official SQLite website:
Replace the following files in SQLite.Universal/SourceCode/ with the new versions:
sqlite3.c → Main SQLite implementationsqlite3.h → Header file with function declarationssqlite3ext.h → Extension header (if available)Update package version in NuGet/package.nuspec:
<version>3.XX.X</version>
Update README (this file):
- **Current SQLite Version**: [3.XX.X](https://www.sqlite.org/chronology.html)
Rebuild the solution for all platforms:
Build → Clean SolutionBuild → Rebuild SolutionTest with sample application:
Samples/TestApplicationStorage projectRun compatibility tests:
Generate nuget package:
>msbuild SQLite3.Universal.sln /p:Configuration=Release /p:Platform=ARM
>msbuild SQLite3.Universal.sln /p:Configuration=Release /p:Platform=ARM64
>msbuild SQLite3.Universal.sln /p:Configuration=Release /p:Platform=x64
>msbuild SQLite3.Universal.sln /p:Configuration=Release /p:Platform=x86
>cd Nuget & nuget pack
Add version checking to your application:
// Get SQLite version at runtime
var version = SQLite3.LibVersionNumber();
var versionString = SQLite3.LibVersion();
Console.WriteLine($"SQLite Version: {versionString} ({version})");
Build Errors: Check for new compilation flags or dependencies in the new SQLite version.
Runtime Issues: Test thoroughly as newer SQLite versions may have behavioral changes.
Performance: Benchmark critical operations to ensure no regression.
Compatibility: Verify database files created with older versions still work.
SQLite3.Universal/
├── SQLite.Universal/ # Main library project
│ ├── SourceCode/ # SQLite source files
│ │ ├── sqlite3.c # SQLite implementation
│ │ ├── sqlite3.h # Main header
│ │ └── sqlite3ext.h # Extension header
│ └── SQLite.Universal.vcxproj
├── NuGet/ # NuGet package configuration
│ ├── package.nuspec # Package specification
│ └── uap10.0/ # Build properties
├── Samples/ # Example applications
│ └── TestApplicationStorage/
└── README.md
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This library provides the native SQLite binaries. For ORM functionality, consider using it with sqlite-net-pcl or similar packages.