No executable found matching command "dotnet-ef" on Ubuntu (.Net Core 1.1)
As per issue #7629 closed
I previously confused this to be isolated just to Ubuntu, but this happens on any Published ASP.Net Core solution.
Trying to do a dotnet ef database update on published folder
\bin\Release\PublishOutput>dotnet ef database update No executable found matching command "dotnet-ef"
Steps:
- Create Asp.net core application in VS 2017 on Windows
- Add Code First models
- Add SapientGuardian.EntityFrameworkCore.MySql package
- Change DbContext to UseMySQL
- Works under Solution command
- Publish to Folder
- Run dotnet ef database update
- Error
Please note latest version installed:
- sudo apt-get install dotnet-dev-1.0.1
- all previous .net version removed as per script instructions
Solution built with latest Visual Studio 2017 as released on 2017-03-07
Same error as before.
Also there is now only a version 1.0 of Microsoft.EntityFrameworkCore.Tools.DotNet.
Would appreciate your assistance.
> root@WCGOV:/var/www/mll# dotnet ef database update
>
> Welcome to .NET Core!
> ---------------------
> Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
>
> Telemetry
> --------------
> The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community.
> You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
> You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
>
> Configuring...
> -------------------
> A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
> Decompressing 100% 9729 ms
> Expanding 100% 46649 ms
> No executable found matching command "dotnet-ef"
> root@WCGOV:/var/www/mll# dotnet ef database update
> No executable found matching command "dotnet-ef"
> root@WCGOV:/var/www/mll#
>
Need to investigate this further on my side. Something to do with the Microsoft.EntityFrameworkCore.Tools.DotNet that need to be published.
My issue was resolved by adding these to project.json "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final", "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final" }
then execute these 2 commands:
- dotnet restore -> to restore packages
- dotnet ef migrations add MyMigration
All the credit goes to: http://know-it.ru/2017/03/15/dotnet-exe-no-executable-found-matching-command-dotnet-ef/