Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Error while generating entity framework scripts #9553


User avatar
0
rajalla created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version?

Latest as of today

  • What is your product type (Angular or MVC)?

MVC

  • What is product framework type (.net framework or .net core)?

.net core

Error While setting up the devops CI/CD as per the instructions provided in step Generate Migration Scripts.

LOG:

2020-08-25T14:39:27.2517773Z ##[section]Starting: Generate Migration Scripts 2020-08-25T14:39:27.2683784Z ============================================================================== 2020-08-25T14:39:27.2685642Z Task : Entity Framework Core Migrations Script Generator 2020-08-25T14:39:27.2686465Z 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'). 2020-08-25T14:39:27.2687131Z Version : 0.0.51 2020-08-25T14:39:27.2687471Z Author : PEK's Productions 2020-08-25T14:39:27.2687951Z Help : More Information 2020-08-25T14:39:27.2688473Z ============================================================================== 2020-08-25T14:39:28.0313933Z Project path: D:\a\1\s\src\ProjectDemo.EntityFrameworkCore\ProjectDemo.EntityFrameworkCore.csproj 2020-08-25T14:39:28.0315403Z Start-up project path: D:\a\1\s\src\MidocsDemo.Web.Mvc\ProjectDemo.Web.Mvc.csproj 2020-08-25T14:39:28.0316394Z Target folder: D:\a\1\a/migrations 2020-08-25T14:39:28.0317108Z Number of database contexts: 1 2020-08-25T14:39:28.0317812Z Checking of dotnet-ef is installed. 2020-08-25T14:39:28.0432560Z [command]"C:\Program Files\dotnet\dotnet.exe" tool list --global 2020-08-25T14:39:28.2692979Z Package Id Version Commands 2020-08-25T14:39:28.2697579Z ------------------------------------- 2020-08-25T14:39:28.2893137Z 2020-08-25T14:39:28.2956875Z Parsing output: "Package Id Version Commands 2020-08-25T14:39:28.2958025Z ------------------------------------- 2020-08-25T14:39:28.2958746Z " 2020-08-25T14:39:28.2959501Z Installing version undefined of dotnet-ef as global tool. 2020-08-25T14:39:28.3065144Z [command]"C:\Program Files\dotnet\dotnet.exe" tool install --global dotnet-ef 2020-08-25T14:39:31.0032882Z You can invoke the tool using the following command: dotnet-ef 2020-08-25T14:39:31.0034693Z Tool 'dotnet-ef' (version '3.1.7') was successfully installed. 2020-08-25T14:39:31.0082521Z 2020-08-25T14:39:31.0203731Z Generating migration script for ProjectDemoDbContext in project D:\a\1\s\src\ProjectDemo.EntityFrameworkCore\MidocsDemo.EntityFrameworkCore.csproj 2020-08-25T14:39:31.0283497Z Default build configuration will be used. 2020-08-25T14:39:31.0284876Z The script will be idempotent. 2020-08-25T14:39:31.0303863Z [command]"C:\Program Files\dotnet\dotnet.exe" ef migrations script --project D:\a\1\s\src\ProjectDemo.EntityFrameworkCore\ProjectDemo.EntityFrameworkCore.csproj --startup-project D:\a\1\s\src\ProjectDemo.Web.Mvc\ProjectDemo.Web.Mvc.csproj --output D:\a\1\a/migrations/ProjectDemoDbContext.sql --context ProjectDemoDbContext --verbose --idempotent 2020-08-25T14:39:31.2083218Z Specify which project file to use because this 'D:\a\1\s' contains more than one project file. 2020-08-25T14:39:31.2102628Z 2020-08-25T14:39:31.2267953Z ##[error]The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1 2020-08-25T14:39:31.2336884Z ##[section]Finishing: Generate Migration Scripts


2 Answer(s)
  • User Avatar
    0
    rajalla created

    Was able to fix it by setting Working directory under advanced options in Generate Migrations Script.

  • User Avatar
    0
    dev1_premierpoint created

    I just got this error too and it ended up consuming about 8 hours of time until I somehow stumbled across this closed question via a google search.

    The answer above is the solution - add the value "src" in the Working Directory field in the Advanced section of the Generate Migration Scripts Task:

    It would be nice if Volosoft added this as a tip to this page of the documentation:

    https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Setting-Up-an-Azure-Pipeline-Mvc-Core