Open Closed

Azure pipeline error #7800


0
serdar created

Daha once calısan pipeline'ım bu hatayı vermeye basladı. Nedeni ne olabilir ?


15 Answer(s)
  • 0
    maliming created
    Support Team

    The process /usr/bin/dotnet failed with exit code 1 Can you share the complete error message?

  • 0
    serdar created

    ##[section]Starting: Generate Migration Scripts

    Task : Entity Framework Core Migrations Script Generator Description : Tool for projects that use Entity Framework Core Code-First. Generates migration scripts which can be used to update a database (for instance with the task 'Azure SQL Database Deployment'). Version : 0.0.30 Author : PEK's Productions Help : More Information

    Project path: /home/vsts/work/1/s/src/Recruitans.EntityFrameworkCore/Recruitans.EntityFrameworkCore.csproj Start-up project path: /home/vsts/work/1/s/src/Recruitans.Web.Mvc/Recruitans.Web.Mvc.csproj Target folder: /home/vsts/work/1/a/migrations Number of database contexts: 1 Checking of dotnet-ef is installed. [command]/usr/bin/dotnet tool list --global Package Id Version Commands

    Installing dotnet-ef as global tool. [command]/usr/bin/dotnet tool install --global dotnet-ef Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. You can invoke the tool using the following command: dotnet-ef Tool 'dotnet-ef' (version '3.0.0') was successfully installed.

    Generating migration script for RecruitansDbContext in project /home/vsts/work/1/s/src/Recruitans.EntityFrameworkCore/Recruitans.EntityFrameworkCore.csproj [command]/usr/bin/dotnet ef migrations script --idempotent --project /home/vsts/work/1/s/src/Recruitans.EntityFrameworkCore/Recruitans.EntityFrameworkCore.csproj --startup-project /home/vsts/work/1/s/src/Recruitans.Web.Mvc/Recruitans.Web.Mvc.csproj --output /home/vsts/work/1/a/migrations/RecruitansDbContext.sql --context RecruitansDbContext --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 ##[section]Finishing: Generate Migration Scripts

  • 0
    maliming created
    Support Team

    Try using the 2.2.6 version of the tool?

    dotnet tool install --global dotnet-ef --version 2.2.6
    
  • 0
    serdar created

    on azure, where ? pipeline'ın neresıne bunu yazmam gerek ?

  • 0
    maliming created
    Support Team

  • 0
    serdar created

    app servis'te mi çalıştırmam gerekiyor ? biraz daha açık yazabilir misiniz.

  • 0
    serdar created

    app servis'te aşağıdaki gibi kurdum. sonra tekrar calıstırdım, yine aynı hatayı alıyorum.

  • 0
    maliming created
    Support Team

    You should use dotnet-ef v2.2.6 in the Generate Migration Scripts step.

  • 0
    serdar created

    yeri dogru mu ?

  • 0
    maliming created
    Support Team

    hi serdar

    In which step did you install the dotnet-ef tool? Or is dotnet-ef installed globally?

    What is your net core sdk version? It should be 2.x.

  • 0
    serdar created

    Dotnet-ef aracını yuklemedım. sizin pipeline dokumanına gore bir azure pipeline olusturdum. onu kullanıyordum. Sonra bu hatayı almaya basladım.

  • 0
    ismcagdas created
    Support Team

    Hi @serdar

    Did you solve the problem ? If not, you can contact with info@aspnetzero.com.

  • 0
    ISTeam created

    To fix this error, I found that ef is not by default included in .NET 3.0 onward releases. So, if we are using .NET Core 3.x then we have to add ef tool packages additionally unlike .NET Core 2.2.

    Below were my first two steps in CI pipeline of Azure DevOps but these can be anywhere before the efcore-migration-script-generator task.

    steps:

    If its .NET Core 3.x

    • task: UseDotNet@2 displayName: 'Use .NET Core sdk 3.x' inputs: packageType: sdk version: 3.x installationPath: $(Agent.ToolsDirectory)/dotnet

    For db migration script generator this dependency task is required since .NET Core 3.x

    • task: CmdLine@2 inputs: script: 'dotnet tool install --global dotnet-ef'

    ...

    all other the tasks.

    But later I found that this is not a proper way of CI. I created CI using YAML but not using classical editor option as mentioned in the guide. And due to that I am having zip files, XMLs and cmd batch files as well in the artifact which should not be.

    But for lot of developers the problem starts from .NET Core 3.x onwards!

  • 0
    serdar created

    didn't solve @ismcagdas

  • 0
    maliming created
    Support Team

    hi serdar

    Have you tried ISTeam's solution?

    https://support.aspnetzero.com/QA/Questions/7800#answer-a8d9bc12-6db8-7b53-1d44-39f3ae5e3f6b