EF Core tools version update 2.1.1

北城以北 提交于 2019-11-30 22:57:25

问题


If I run dotnet ef add testmigration

I get this warning: The EF Core tools version '2.1.0-rtm-30799' is older than that of the runtime '2.1.1-rtm-30846'. Update the tools for the latest features and bug fixes.

So I checked my csproj file:

<ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
</ItemGroup>

Which looks correct to me, version 2.1.1. So I checked the docs, here

And they suggest the tools entry in the csproj needs to have this package:

<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.1" />
</ItemGroup>

Now a dotnet restore complains that:

warning : The tool 'Microsoft.EntityFrameworkCore.Tools.DotNet' is now included in the .NET Core SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box).

And dotnet ef --version still lists the old one.

So the next thing I do is remove the entry in the csproj altogether, now dotnet ef still works, but still gives me the old version.

So I figured I somehow must update the dotnet global tools for EF. But a 'dotnet tools list -g' gives me no results.

All very confusing.

Where does the old version come from, how do I get rid of it/update it?


回答1:


Ok.

Turns out that this is caused by having the second latest sdk installed (2.1.301), but somewhere in the path a global.json pinned to version 2.1.300.




回答2:


install-package Microsoft.EntityFrameworkCore.Tools -Version 2.1.8

did it for me




回答3:


This error is also shown when you select a different project on Package Manager Console rather than the Entity Framework project in your solution.




回答4:


I was having this exact problem. I tried deleting bin folders and rebuilding as others have suggested but that never worked. Finally I updated the SDK to 2.1.403 and the issue was resolved.



来源:https://stackoverflow.com/questions/51284974/ef-core-tools-version-update-2-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!