錯誤現象:
$ dotnet ef migrations add InitialCreate
$ 無法解析包“Microsoft.EntityFrameworkCore.Tools.DotNet”的版本。
解決方案:
1. 打開項目文件,擴展名:csproj
修改下面的節點:
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" /> <!-- 增加 -->
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" /> <!-- 增加 -->
</ItemGroup>
$ dotnet restore
$ dotnet ef migrations add InitialCreate
Bingo!!!
