Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet ef tool not working since vs2017 / netcore1.1

I recently upgraded a project to use efcore 1.1 as well as visual studio 2017 rc. Also using win10.

The dotnet ef commands previously worked with no issue, but now they just throw the following errors.

{path}.csproj : error MSB4057: The target "_EFGetProjectMetadata" does not exist in the project.

Couldn't read metadata for project '{path}.csproj'. Ensure the package 'Microsoft.EntityFrameworkCore.Tools' is installed.

I verified that the tools are installed, ran dotnet restore, everything builds/runs fine. It's only the ef tooling that is causing issues.

Inside the .csproj file, the following appears.

<PackageReference Include="Microsoft.EntityFrameworkCore.Tools"> <Version>1.1.0-preview4-final</Version> </PackageReference>

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

like image 380
Brad M Avatar asked Nov 17 '16 20:11

Brad M


2 Answers

Use version1.0.0-msbuild1-final for theMicrosoft.EntityFrameworkCore.Tools also.

<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
  <Version>1.0.0-msbuild1-final</Version>
</PackageReference>    

That got things working for me using dotnet core CLI tools 1.0.0-preview3-004056.

like image 169
backpackcoder Avatar answered Oct 07 '22 13:10

backpackcoder


We are currently tracking this issue at https://github.com/aspnet/EntityFramework/issues/7072. We will keep that thread updated as we diagnose the issue, find workarounds, etc.

like image 21
Rowan Miller Avatar answered Oct 07 '22 12:10

Rowan Miller