pekspro / EF-Migrations-Script-Generator-Task

24 stars 7 forks source link

V0.0.30 failing to work with .Net Core 2.2 since update of .Net Core 3 #9

Closed Dude5th closed 4 years ago

Dude5th commented 4 years ago

My builds are failing now since the latest Task release it seems. Not just one project but all the projects that are using this Task Generator are failing. My log is:

Will not try to install dotnet-ef. If you are using .NET Core 3 you could enable 'Install dependencies for .NET Core 3' to do this automatically. Generating migration script for DatabaseContext in project /home/vsts/work/1/s/ProductSearch/MasterProductDatabase/MasterProductDatabase.csproj /usr/bin/dotnet ef migrations script --idempotent --project /home/vsts/work/1/s/ProductSearch/MasterProductDatabase/MasterProductDatabase.csproj --startup-project /home/vsts/work/1/s/ProductSearch/ProductConfigurator/ProductConfigurator.csproj --output /home/vsts/work/1/a/migrations/DatabaseContext.sql --context DatabaseContext --verbose 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.

[error]The process '/usr/bin/dotnet' failed with exit code 1

Finishing: efcoremigrationscriptgeneratortask

pekspro commented 4 years ago

I’m sorry to hear that. If your projects are using .NET Core 2.x, and the agents are running .NET Core 3 I guess you could get this problem. One quick fix for this is to use a build again that are running VS2017, I think they are only using .NET Core 2.

Another way to fix this is to add Use .NET Core task first in the pipeline. If you enter 2.x as version .NET Core 2 should be used for the rest of the pipeline.

I think this should work. Give it a try and let me know what happens :-)

Dude5th commented 4 years ago

Both work well, thank you. For the second point, we used: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops