"dotnet-ef does not exist" in .net core heroku application

asp.net-core entity-framework-core heroku postgresql

Question

I am using jincod's Heroku .NET Core Buildpack to deploy my Core 3.1 MVC application to heroku.

Currently i am trying to apply EF migrations to postgre DB (using Npgsql) by executing command on publish:

  <Target Name="PrePublishTarget" AfterTargets="Publish">
    <Exec Command="dotnet tool install --global dotnet-ef" />
    <Exec Command="dotnet ef database update" />
  </Target>

Build fails with these messages:

  You can invoke the tool using the following command: dotnet-ef
  Tool 'dotnet-ef' (version '3.1.3') was successfully installed.
  Could not execute because the specified command or file was not found.
  Possible reasons for this include:
    * You misspelled a built-in dotnet command.
    * You intended to execute a .NET Core program, but dotnet-ef does not exist.
    * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
/tmp/build_35cf57c00fbf62634ac8d644c6e8f4f7/BugTracker.csproj(38,5): error MSB3073: The command "dotnet ef database update" exited with code 1.
 !     Push rejected, failed to compile ASP.NET Core app.
 !     Push failed

I explicitly install dotnet-ef, but for some reason it cannot find it?

1
1
4/13/2020 10:51:04 AM

Accepted Answer

You need to add "dotnet-tools.json". More info here https://github.com/jincod/dotnetcore-buildpack/pull/104

1
4/14/2020 8:41:39 AM


Related Questions





Related

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