I had the same problem, but then I had not updated the publish profile file(.pubxml) for the right targetenvironment
< TargetFramework>netcoreapp2.1< /TargetFramework>
And regarding to earlier answer the row
< DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />
Show be removed in 2.1 version beacuse of obsolete and are included nowaday