Installation

The core library, database driver, optional DI integration and CLI each have a distinct job.

Examples use Classic and Fluent tabs. Your choice follows you through the manual.

Choose your packages

PackagePurpose
DotNetProjects.MigratorMigration classes, providers, runner and fluent operations.
An ADO.NET driverInstall the driver for the database your host opens.
DotNetProjects.Migrator.Extensions.DependencyInjectionOptional scoped runner, constructor injection and Microsoft logging.
DotNetProjects.Migrator.ToolThe migrator command-line tool.
Terminal · either authoring style

Classic

dotnet new console -n MigrationDemo -f net9.0
cd MigrationDemo
dotnet add package DotNetProjects.Migrator
dotnet add package Microsoft.Data.Sqlite --version 9.0.7

Fluent

dotnet new console -n MigrationDemo -f net9.0
cd MigrationDemo
dotnet add package DotNetProjects.Migrator
dotnet add package Microsoft.Data.Sqlite --version 9.0.7

Shared commands · both styles

Choose a driver

Common choices are Microsoft.Data.Sqlite, Microsoft.Data.SqlClient, Npgsql, MySql.Data, Oracle.ManagedDataAccess.Core and FirebirdSql.Data.FirebirdClient. The core library does not directly reference these packages. Passing an open connection makes driver selection explicit and keeps connection ownership with your application.

Read the provider overview for database families, aliases and CI coverage. A provider name is not a guarantee that every native operation has the same behavior on every server.

Use the repository

To develop against a checkout, replace the core package reference with a project reference to src/Migrator/DotNetProjects.Migrator.csproj. The solution targets .NET 9. Building the .slnx solution requires an SDK that understands that format, such as SDK 9.0.200 or later.

Keep the library, CLI and optional DI integration on compatible versions. Recompile old migration assemblies when updating a breaking API; the upgrade guide explains the column and constraint changes.