efcore: Entity Framework Tools not working after update to EF Core 1.1.0
Steps to reproduce
Update .NET Core packages (including ASP.NET Core and EF Core) in solution from 1.0.0 to 1.1.0.
Update package "Microsoft.EntityFrameworkCore.Tools" : "1.0.0-preview2-final"
to "Microsoft.EntityFrameworkCore.Tools" : "1.1.0-preview4-final"
. Alternatively, change to package "Microsoft.EntityFrameworkCore.Tools.DotNet" : "1.1.0-preview4-final"
as per the anncouncement.
The issue
When using the Microsoft.EntityFrameworkCore.Tools
package and trying to invoke any dotnet ef
command on the console, the error message is thrown:
No executable found matching command “dotnet-ef”.
When using the Microsoft.EntityFrameworkCore.Tools
package and trying to invoke any entity framework tooling command on the Package Manager Console, the same error is thrown:
PM> add-migration Test No executable found matching command “dotnet-ef”
When trying to install the package Microsoft.EntityFrameworkCore.Tools.DotNet
via Package Manager Console, the following error message is thrown:
install-package : Package ‘Microsoft.EntityFrameworkCore.Tools.DotNet 1.1.0-preview4-final’ uses features that are not supported by the current version of NuGet. To upgrade NuGet, see http://docs.nuget.org/consume/installing-nuget.
When trying to install the package Microsoft.EntityFrameworkCore.Tools.DotNet
via project.json
, the following error is logged to the Output window:
Package Microsoft.EntityFrameworkCore.Tools.DotNet 1.1.0-preview4-final is not compatible with net461 (.NETFramework,Version=v4.6.1). Package Microsoft.EntityFrameworkCore.Tools.DotNet 1.1.0-preview4-final supports: netcoreapp1.0 (.NETCoreApp,Version=v1.0) One or more packages are incompatible with .NETFramework,Version=v4.6.1.
Further technical details
EF Core version: 1.1.0 Operating system: Win10 Visual Studio version: VS 2015 Update 3
Other details about my project setup:
PM> dotnet --version 1.0.0-preview2-1-003177
I have an ASP.NET Core application targeting the full .NET framework. Thus I need the net461
entry in the frameworks
section of project.json
.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 37 (14 by maintainers)
I haven’t been able to use the 1.1.0 version, I had to use:
"Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final"
So I have all my entityframework dependencies with 1.1.0 version except the tools and the design dll. That’s the only way I made it work.
After trying alot of combinations, this is what works with my framework:
“dependencies”: { “System.Net.Http”: “4.3.0”, “YeshuApp.Models”: “1.0.0-*”, “Microsoft.NETCore.App”: “1.1.0”, “Microsoft.ApplicationInsights”: “2.2.0”, “Microsoft.EntityFrameworkCore”: “1.1.0”, “Microsoft.EntityFrameworkCore.SqlServer”: “1.1.0”, “Microsoft.EntityFrameworkCore.Relational”: “1.1.0”, “Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore”: “1.1.0”, “Microsoft.EntityFrameworkCore.SqlServer.Design”: “1.1.0”, “Newtonsoft.Json”: “9.0.1”, “Microsoft.EntityFrameworkCore.Tools.DotNet”: “1.0.0-preview3-final”, “Microsoft.EntityFrameworkCore.Design”: “1.0.0-preview2-final”, “Microsoft.EntityFrameworkCore.Tools”: “1.0.0-preview2-final” }, “frameworks”: { “netcoreapp1.1”: { “imports”: [ “dotnet5.6”, “portable-net45+win8” ] } }, “tools”: { “Microsoft.EntityFrameworkCore.Tools”: “1.0.0-preview2-final”, “Microsoft.EntityFrameworkCore.Tools.DotNet”: “1.0.0-preview2-final”, “Microsoft.EntityFrameworkCore.Design”: “1.0.0-preview2-final” },
Hello all,
My team was able to resolve this issue updating the project.json file in the migrations project. We removed the following from dependencies: , “Microsoft.EntityFrameworkCore.Tools”: { “type”: “build”, “version”: “1.1.0-preview4-final” }
We added the following to tools
“tools”: { “Microsoft.EntityFrameworkCore.Tools”: “1.1.0-preview4-final”, “Microsoft.EntityFrameworkCore.Tools.DotNet”: “1.1.0-preview4-final” },
you are then able to run the following command to deploy from your migrations project using your web project.
dotnet ef --startup-project …<Web Project>\ database update
my example: dotnet ef --startup-project …\CoreServices.Web\ database update
I hope this helps you guys as well.
Jason
I think I have roughly the same issue:
I have a ASP.NET Core project that runs ONLY on the Full .NET Framework 4.6.1 (not .NET Core).
However, I cannot make the tooling work after upgrading to 1.1 (Using the Package Manager only).
My DbContext is located in a library project that is referenced by the main web project.
I have tried with: “Microsoft.EntityFrameworkCore.Tools”: -> When I use this, I am simply told the following: Could not find assembly ‘C:\path\to\solution\ProjectName.\bin\Debug\net461\win7-x64\ProjectWithContextName.exe’.
“Microsoft.EntityFrameworkCore.Tools.DotNet”: -> This simply does not target the full .NET, so I cannot use it.
I have also tried updating to the latest nuget package manager. This does not solve the problem.
If I set the ‘Default project’ to my main web project in the Package Manager Console and attempt to execute the command, I am told: No DbContext named ‘ApplicationDbContext’ was found.
So I think the tooling can at the very least be found.
@solenovex No, you placed “Microsoft.EntityFrameworkCore.Tools” under tools, it needs to be “Microsoft.EntityFrameworkCore.Tools.DotNet”
@solenovex You also need to upgrade “Microsoft.EntityFrameworkCore.Tools.DotNet” to “1.1.0-preview4-final” in the tools section
I am having similar issues running add-migration from package manager console. I have updated Tools to 1.1.0-preview4-final.
I have this in my dependencies:
"Microsoft.EntityFrameworkCore.Design": "1.1.0"
I’ve reproduced this with a completely new project, it works using netcoreapp1.1 but not with net46 or net451. These are the project.jsons, the topmost one works and the bottom one does not:
Not working:
It seems like support for net46 is not complete?
@MikaelGRA - Thanks for Whatever 😉
I cloned the repo. Opened solution in VS. Following is the output from PMC afterwards.
Due the first error the only code I had to modify was
Let me know if you still face any issues.
What about Visual Studio 2017?
project.json is replaced with project.csproj
but dotnet ef is still looking for project.json
After 1.0.0-preview2-final, we split the package into two–the one that should be under dependencies (Microsoft.EntityFrameworkCore.Tools) and the one that should be under tools (Microsoft.EntityFrameworkCore.Tools.DotNet)
@Artur-A
tools
is specifically for registering .NET CLI Tools, so onlyMicrosoft.EntityFrameworkCore.Tools.DotNet
should be in there.Microsoft.EntityFrameworkCore.Design
andMicrosoft.EntityFrameworkCore.Tools
both go as regular dependencies.https://github.com/aspnet/EntityFramework/issues/7071 tracks the
Unrecognized option '--config'
issueI’m using the command line, I have the same issue. After Installing .netcore 1.1 and Uninstalling .netcore 1.0 Then I upgrade the eftools(“Microsoft.EntityFrameworkCore.Tools”) to version “1.1.0-preview4-final”. When I run “dotnet ef xxx”, it shows "No executable found matching command “dotnet-ef”. Environment: windows 10, VSCode, command line. (No visual studio installed).