Efcore: unable to add migrations

Created on 28 Feb 2017  路  2Comments  路  Source: dotnet/efcore

I'm trying to enable migrations on a class library project. But every type I run the command dotnet ef migrations add Initial then I have the No executable found matching command "dotnet-ef" error.

This is my .csproj file:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TargetFramework>netcoreapp1.1</TargetFramework>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL">
            <Version>1.1.0</Version>
        </PackageReference>
        <PackageReference Include="Microsoft.EntityFrameworkCore">
            <Version>1.1.0</Version>
        </PackageReference>
        <PackageReference Include="Microsoft.EntityFrameworkCore.Design">
            <Version>1.1.0</Version>
        </PackageReference>
        <PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet">
            <Version>1.1.0-preview4-final</Version>
        </PackageReference>
    </ItemGroup>
    <ItemGroup>
        <ProjectReference Include="..\Organizer.Domain\Organizer.Domain.csproj">
            <Project>{D3276E9C-4A92-47EC-BF15-61EC5B78655D}</Project>
            <Name>Organizer.Domain</Name>
        </ProjectReference>
    </ItemGroup>
    <ItemGroup>
      <Folder Include="EntityConfig\" />
      <Folder Include="Context\" />
    </ItemGroup>
</Project>
closed-question

Most helpful comment

Hi there. It looks like your reference to the tools is in the wrong part of the project file. Take the Package Reference to Microsoft.EntityFrameworkCore.Tools.DotNet out聽and add the below snippet to your project. Also because you are using csproj and not project.json you need to use聽the 1.0.0-msbuild3-final tooling rather than the 1.1.0-preview4-final that you have in your project.

I hope that helps聽get you going :-)

    <ItemGroup>
        <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" />
    </ItemGroup>

All 2 comments

Hi there. It looks like your reference to the tools is in the wrong part of the project file. Take the Package Reference to Microsoft.EntityFrameworkCore.Tools.DotNet out聽and add the below snippet to your project. Also because you are using csproj and not project.json you need to use聽the 1.0.0-msbuild3-final tooling rather than the 1.1.0-preview4-final that you have in your project.

I hope that helps聽get you going :-)

    <ItemGroup>
        <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" />
    </ItemGroup>

Thank you! it's working now

Was this page helpful?
0 / 5 - 0 ratings