Fluentmigrator: Cannot find extension method AddFluentMigratorCore

Created on 31 Jan 2019  路  8Comments  路  Source: fluentmigrator/fluentmigrator

Hi,

I'm trying out this library for my project, but can't get it set up.

From the samples, I try

var services = new ServiceCollection()
    .AddFluentMigratorCore();

My IntelliSense tells me this method is not available and I also couldn't find it in this repo.

I tried this with a console app using .netcoreapp2.2, .netcoreapp2.0, and .NETFramework4.6.1.
My installed nuget packages are

  • FluentMigrator (3.1.3),
  • FluentMigrator.Runner.SqlServer (3.1.3),
  • FluentMigrator.Extensions.SqlServer (3.1.3)

I feel like I'm missing something very simple. Do you know what it could be?

Most helpful comment

In my scenario I'm only using one specific runner (MySql). So I don't necessarily want to add all the indirect dependencies for the other database types to my project.
It would be nicer to move AddFluentMigratorCore to the FluentMigrator.Runner.Core or to a new FluentMigrator.Runner.DependencyInjection package.

All 8 comments

You need the package FluentMigrator.Runner.

EDIT: Please take a look at the quick start tutorial.

My mistake for believing tht FluentMigrator.Runner.SqlServer contained FluentMigrator.Runner.
Thanks for the quick reply!

@maxmantz Same "problem" with PostgreSQL for me. It's really natural to think that FM.Runner.{Db} references FM.Runner.

I'm with this problem. I'm using postgres database and i put

using FluentMigrator.Runner;
using FluentMigrator.Runner.Initialization;
using FluentMigrator;

In the configuration, I used

services.AddFluentMigratorCore()
                .ConfigureRunner(rb => rb
                    // Add SQLite support to FluentMigrator
                    .AddPostgres()
                    // Set the connection string
                    .WithGlobalConnectionString(Configuration.GetConnectionString("DefaultConnection"))
                    // Define the assemblies containing the migrations
                    .ScanIn(typeof(CreateApps).Assembly).For.Migrations()
                ).AddLogging(lb => lb
                    .AddFluentMigratorConsole());

In configure services. Anyone has an idea about it?

Did you install the package FluentMigrator.Runner?

Yes.

Can you clear your obj and bin directories?

Dll location is driven by MSBuild targets written by Microsoft.

In my scenario I'm only using one specific runner (MySql). So I don't necessarily want to add all the indirect dependencies for the other database types to my project.
It would be nicer to move AddFluentMigratorCore to the FluentMigrator.Runner.Core or to a new FluentMigrator.Runner.DependencyInjection package.

Was this page helpful?
0 / 5 - 0 ratings