EF Core 工具版本更新 2.1.1 [英] EF Core tools version update 2.1.1
问题描述
如果我运行 dotnet ef add testmigration
我收到此警告:EF Core 工具版本2.1.0-rtm-30799"比运行时版本2.1.1-rtm-30846"旧.更新工具以获取最新功能和错误修复.
所以我检查了我的 csproj 文件:
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>
在我看来是正确的,版本 2.1.1.所以我检查了文档,这里
Which looks correct to me, version 2.1.1. So I checked the docs, here
并且他们建议 csproj 中的工具条目需要有这个包:
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>
现在 dotnet restore
抱怨:
警告:工具Microsoft.EntityFrameworkCore.Tools.DotNet"现在包含在 .NET Core SDK 中.有关解决此警告的信息,请访问 (https://aka.ms/dotnetclitools-in-box).
并且 dotnet ef --version
仍然列出旧的.
And dotnet ef --version
still lists the old one.
所以接下来我要做的是完全删除 csproj
中的条目,现在 dotnet ef
仍然有效,但仍然给我旧版本.
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.
所以我想我必须以某种方式更新 EF 的 dotnet 全局工具.但是dotnet 工具列表 -g"没有给我任何结果.
So I figured I somehow must update the dotnet global tools for EF. But a 'dotnet tools list -g' gives me no results.
一切都很混乱.
旧版本从何而来,如何去除/更新?
Where does the old version come from, how do I get rid of it/update it?
推荐答案
好的.
事实证明,这是由于安装了第二个最新的 sdk (2.1.301) 引起的,但在路径中的某个地方将 global.json 固定到版本 2.1.300.
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.
这篇关于EF Core 工具版本更新 2.1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!