Reputation: 4045
I am running the following command in Powershell to create an initial migration:
dotnet ef migrations add INITIAL --context CATALOGDbContext -s ../Jobsledger.API
While it works (I am able to create the migration and database) its providing the following warning :
The EF Core tools version '2.2.4-servicing-10062' is older than that of the runtime '3.0.0'. Update the tools for the latest features and bug fixes.
This, I think results in a problem with the outcome in that my tables are now missing the id in the first record. Its literally blank. I dont know how this can work perfectly in 2.2.4 but now upgraded to 3.0.0 its creating the first record with a blank id field...
I went to the site "Entity Framework Core tools reference - Package Manager Console in Visual Studio" Which went through the steps to upgrade the tools.
Whilst I have everything set to 3.0.0 I am still getting the above error even though I have tried their suggestions on this page. I did update the .csproj file and I even tried the Package manager Console option and I still get the error.
I am using Visual Studio 19 fully upgraded to version 16.4.0 Preview 1.
How do I get this warning to disappear ie how do I update the EF tools?
UPDATE So I rebuilt my project from scratch making sure that I added all the packages again and still got the same outcome.
I also deleted everything in the nuget directory and let it reload all the packages again and still got the same outcome.
This project consists of three projects the web project and two database class libraries.
Here is my csproj file for the web project.
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>3.6</TypeScriptToolsVersion>
<TypeScriptBuildMode>true</TypeScriptBuildMode>
</PropertyGroup>
<ItemGroup>
<Compile Remove="ControllerServices\Catalog\UserServices\UserValidateService.cs" />
<Compile Remove="Controllers\SampleDataController.cs" />
<Compile Remove="Controllers\SelectDataController.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="wwwroot\favicon.ico" />
</ItemGroup>
<ItemGroup>
<None Remove="ClientApp\app\components\clients\clientList\client-detail-view.ts" />
<None Remove="ClientApp\app\components\clients\clientList\objectkeysValueConverter.ts" />
<None Remove="ClientApp\app\navmenu\ActiveRoute.ts" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="8.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.5.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.19" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JobsLedger.CATALOG\JobsLedger.CATALOG.csproj" />
<ProjectReference Include="..\JobsLedger.DATA\JobsLedger.DATA.csproj" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="ClientApp\app\components\clients\clientList\client-detail-view.ts" />
<TypeScriptCompile Include="ClientApp\app\navmenu\activeRoute.ts" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
</ItemGroup>
<Target Name="DebugRunWebpack" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('wwwroot\dist') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<!-- In development, the dist files won't exist on the first run or when cloning to
a different machine, so rebuild them if not already present. -->
<Message Importance="high" Text="Performing first-run Webpack build..." />
<Exec Command="npm install" />
<Exec Command="npm ddp" />
<Exec Command="npm run webpack:dev" />
</Target>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec Command="npm install" />
<Exec Command="npm ddp" />
<Exec Command="npm run webpack:$(Configuration)" />
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<!-- First, clean up previously generated content that may have been removed. -->
<ContentWithTargetPath Remove="@(ContentWithTargetPath)" Condition="!Exists('%(Identity)')" />
<_WebpackFiles Include="wwwroot\dist\**" />
<ContentWithTargetPath Include="@(_WebpackFiles->'%(FullPath)')" RelativePath="%(_WebpackFiles.Identity)" TargetPath="%(_WebpackFiles.Identity)" CopyToPublishDirectory="Always" />
</ItemGroup>
</Target>
Here is the csproj file for the CATALOG database class library.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.19" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Abstractions">
<HintPath>..\..\..\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.0.0-preview5-19227-01\ref\netcoreapp3.0\Microsoft.AspNetCore.Http.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
and here is the csproj file for the last class library DATA
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.19" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JobsLedger.CATALOG\JobsLedger.CATALOG.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Abstractions">
<HintPath>..\..\..\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.0.0-preview5-19227-01\ref\netcoreapp3.0\Microsoft.AspNetCore.Http.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
How do I get this project to use the EntityFramework tools 3.0.0??
Upvotes: 1
Views: 720
Reputation: 4045
OK so I ended up backing up the computer and doing a complete install. A bit of a pain but then I installed a new copy of Visual Studio 2019 but looking very carefully to make sure there was nothing to do with 2.2. I only loaded the latest framework and core. Once I did this I then set about checking if I actually had the correct EF and this time I did. I have no idea why it got hung up with the older tool set and trying to blow away this tool set just didnt work.. having the correct tool set meant for me it worked.
Upvotes: 0
Reputation: 151
I had a similar problem this week, what worked for me was to uninstall the entity framework tools and reinstall them again.
dotnet tool uninstall --global dotnet-ef
dotnet tool install --global dotnet-ef --version 3.0.0-*
For me the --version
did the trick as otherwise I got a wired error.
Upvotes: 5
Reputation: 260
Please follow this guide: https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet
With .dotnet core 3.0 you have to install ef via dotnet tool install --global dotnet-ef
.
Use dotnet ef
to verify version.
Upvotes: 0
Reputation: 363
Just a guess, but i think your references of EF in your project is still old. Can you try that removing reference of EF from your project and add it again (which will get you updated version of EF)
Upvotes: 0