I've already read through pretty much every other issue regarding EF in that was posted in the past 2 years. I have had no problems downloading other packages, it's only Entity Framework that will not install for me.

I've even tried installing the latest version of Nuget and using it's tool inside of my project directory to restore the packages -after- I added a this line to my .csproj:

<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.2" />

First I tried this command:

dotnet restore

which output this:

C:\Path\To\My\Project>dotnet restore
Restore completed in 100.41 ms for C:\Path\To\My\Project\TestNuget.csproj.
Restore completed in 68.84 ms for C:\Path\To\My\Project\TestNuget.csproj.

and results in this:

> dotnet ef
No executable found matching command "dotnet-ef"

So then I tried this (using the latest version of Nuget as of today's date):

nuget restore Example.csproj

which outputs this:

MSBuild auto-detection: using msbuild version '' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin'.
Committing restore...
Tool assets file has not changed. Skipping assets file write. Path: C:\Path\ToNuget\.nuget\packages\.tools\\2.0.3\netcoreapp2.0\project.assets.json
Restore completed in 139.95 ms for C:\Path\To\User\source\repos\Example\Example\Example.csproj.
Committing restore...
Assets file has not changed. Skipping assets file writing. Path: C:\Path\To\User\source\repos\Example\Example\obj\project.assets.json
Restore completed in 113.51 ms for C:\Path\To\User\source\repos\Example\Example\Example.csproj.

NuGet Config files used:
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.Fallback.config

Feeds used:
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Which has the same results.

I'm not at all sure what the problem is, everything I'm reading online, including is stating that all you have to do is a alter the .csproj file and restore using the dotnet/nuget package managing tool, but this seems to do absolutely nothing to my project, and dotnet-ef.exe is still no where to be found.

4/8/2018 7:29:49 AM

Popular Answer

I did the following and it works,

  1. Create a new .NET Core MVC Web App
  2. Go to command prompt, change the dir to your application project folder
  3. Execute the following command
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet restore

After the above commands are executed, Include the below lines in your .csproj file (just before the closing Project tag)

  <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />

The complete .csproj file may look like as below,

<Project Sdk="Microsoft.NET.Sdk.Web">


    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.2" />

    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
  <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />


Type dotnet ef

If all the configurations are fine, you will see the following response

               ---==/    \\
         ___  ___   |.    \|\
        | __|| __|  |  )   \\\
        | _| | _|   \_/ |  //|\\
        |___||_|       /   \\\/\\

Entity Framework Core .NET Command Line Tools 2.0.0-rtm-26452

Usage: dotnet ef [options] [command]

  --version        Show version information
  -h|--help        Show help information
  -v|--verbose     Show verbose output.
  --no-color       Don't colorize output.
  --prefix-output  Prefix output with level.

  database    Commands to manage the database.
  dbcontext   Commands to manage DbContext types.
  migrations  Commands to manage migrations.

Use "dotnet ef [command] --help" for more information about a command.
4/8/2018 8:25:05 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow