The version for the package `Microsoft.EntityFrameworkCore.Tools.DotNet` cannot be resolved.

I am deploying a new .NET Core application on my server. I am trying to start EntityFramework migration as the project was created using the "code-first" method.

Command to run

Dotnet ef database update

Migrations work locally using visual studio without problems, however on the server I get an error:

The version for Microsoft.EntityFrameworkCore.Tools.DotNet cannot be resolved.

Version on my DotNet 1.0.0 development machine

Version on my DotNet 1.0.1 server

My project uses the .csproj file (and not project.json, which is no longer used).

I added a link to the csproj file, but regardless of the version, I still get the above error.

  <ItemGroup> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.1" /> </ItemGroup> 

Update

Basically I tried installing Microsoft.EntityFrameworkCore.Tools.DotNet from the command line using NUGET:

C: \ Program Files (x86) \ Jenkins \ workspace \ api.XXX.com \ XXXProject> nuget i nstall Microsoft.EntityFrameworkCore.Tools.DotNet

Then I get the following:

A WARNING. Installation error. Rollback ... Performing nuget actions took 13.44 seconds. The package 'Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0' has the package type 'D otnetCliTool', which is not supported by the project 'C: \ Program Files (x86) \ Jenkins \ w orkspace \ api.XXX.com \ XXXProject'.`

Then, if I run the dotnet ef command, I get the following:

C: \ Program Files (x86) \ Jenkins \ workspace \ api.desully.com \ deSullyAPI_Core> dotnet ef update database

The version for Microsoft.EntityFrameworkCore.Tools.DotNet cannot be resolved.

Update # 2

I noticed that my dev machine has different versions of the SDK in it than the version on the server

Dev box enter image description here

Production box enter image description here

I assume the problem is that 1.0.1 does not have Microsoft.EntityFrameworkCore.Tools.DotNet in it? Isn't it weird what the old version does?

Update 3

So, fyi - I went to the Microsoft website to try to download version 1.0 of the SDK (since it did not seem to install on my server). Unfortunately, the MS site seems to be forcing me to download version 1.0.1 (which does not contain the EF file I need?).

I tried to copy the 1.0.0 file from my dev module to the production server, but that didn't work either. What am I missing here?

+13
c # entity-framework .net-core core entity-framework-core
source share
2 answers

No version 1.0.1 Microsoft.EntityFrameworkCore.Tools.DotNet (at the time of writing). You need to set Version="1.0.0" to restore the package.

Available versions are listed on NuGet .

Update:

To use the CLI tools, you first need to add the <DotNetCliToolReference> elements, as you already did.

Then you call dotnet restore in the project directory to load packages into the local cache, then the tool becomes usable and dotnet ef can be used.

+27
source share

What helped in my case (.NET Core 2.0.3) was to release:

dotnet add package Microsoft.EntityFrameworkCore.Design

And then

dotnet restore

This installed Microsoft.EntityFrameworkCore.Tools.DotNet in the correct version

+1
source share

All Articles