Unable to resolve Microsoft.EntityFrameworkCore.Tools

asp.net-core entity-framework-core

Question

My ASP.NET Core project is about a year old and uses EF Core with Postgres. I ran a dotnet migrate which converted my old project.json to a new csproj. And now the project no longer compiles. Specifically, when I run a dotnet restore I get the following error:

Unable to resolve 'Microsoft.EntityFrameworkCore.Tools (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.

Here is what my csproj currently looks like:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" />
    <PackageReference Include="Npgsql" Version="3.2.1" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0" />
  </ItemGroup>

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

</Project>

How can I resolve this dependency issue and get back on track? (Ideally, I want to future-proof as much as possible)

1
1
2/20/2017 2:31:48 AM

Accepted Answer

I think you should be upgraded Microsoft.EntityFrameworkCore.Tools to 1.1.0-preview4-final version by:

  • Run the following command in Package Manager Console

    Install-Package Microsoft.EntityFrameworkCore.Tools -Version 1.1.0-preview4-final

  • Or manually change to <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-preview4-final" /> in .csproj file

Hope this help!

2
2/20/2017 9:12:35 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow