Installation
FluentMigrator can be installed in several ways depending on your project type and preferences.
Package Installation
Core Packages
All projects need these base packages:
Database Provider Packages
Choose the package for your database provider:
Installation Methods
.NET CLI
dotnet add package FluentMigrator
dotnet add package FluentMigrator.Runner
# And then the provider package you need ...Package Manager Console (Visual Studio)
Install-Package FluentMigrator
Install-Package FluentMigrator.Runner
# And then the provider package you need ...Package Manager UI
- Right-click on your project in Solution Explorer
- Select "Manage NuGet Packages"
- Search for "FluentMigrator" and install the required packages
Command Line Tools
.NET Tool
Install the FluentMigrator .NET tool for command-line usage:
dotnet tool install -g FluentMigrator.DotNet.CliUsage:
dotnet fm migrate -p sqlserver -c "Server=.;Database=MyApp;Trusted_Connection=true;" -a "MyApp.dll"MSBuild Integration
For MSBuild integration, add the MSBuild package.
dotnet add package FluentMigrator.MSBuildInstall-Package FluentMigrator.MSBuildProject Templates
Console Application Template
Create a new console application for running migrations:
dotnet new console -n MyApp.Migrations
cd MyApp.Migrations
dotnet add package FluentMigrator
dotnet add package FluentMigrator.Runner
dotnet add package FluentMigrator.Runner.SqlServerWeb Application Integration
For ASP.NET Core applications, add migration support to your existing web project:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentMigrator" Version="7.2.0" /> <!-- Use the latest stable version -->
<PackageReference Include="FluentMigrator.Runner" Version="7.2.0" />
<PackageReference Include="FluentMigrator.Runner.SqlServer" Version="7.2.0" />
</ItemGroup>
</Project>Framework Support
FluentMigrator supports multiple .NET frameworks:
- .NET 8.0+ ✅ (Recommended)
- .NET Framework 4.8 ✅
Version Compatibility
| FluentMigrator Version | .NET Version | Status |
|---|---|---|
| 7+ | .NET 8+ | Current |
| 5+ | .NET 5+ | Legacy |
| 3.x | .NET Core 2+ | Unsupported |
Verification
After installation, verify that FluentMigrator is properly installed by creating a simple migration:
using FluentMigrator;
[Migration(1)]
public class TestMigration : Migration
{
public override void Up()
{
// Migration code here
}
public override void Down()
{
// Rollback code here
}
}If the code compiles without errors, FluentMigrator is correctly installed.
Common Installation Issues
Package Conflicts
If you encounter package conflicts, ensure all FluentMigrator packages are the same version:
<PackageReference Include="FluentMigrator" Version="7.2.0" /> <!-- Use the latest stable version -->
<PackageReference Include="FluentMigrator.Runner" Version="7.2.0" />
<PackageReference Include="FluentMigrator.Runner.SqlServer" Version="7.2.0" />Missing Database Provider
Error: "No database provider registered"
Solution: Install the appropriate database provider package for your database.
Assembly Loading Issues
If you get assembly loading errors, ensure your target framework is compatible and all dependencies are properly installed.
Se e the FAQ for more help.
Next Steps
Once FluentMigrator is installed, proceed to:
- Configuration - Comprehensive configuration guide for all scenarios
- Quick Start Guide - Create your first migration
- Creating Tables - Learn the table creation API
- Database Providers - Provider-specific configuration