dotnet-ef迁移是否在GITLAB中不起作用?

时间:2020-08-23 12:35:04

标签: entity-framework-core gitlab gitlab-ci

我正在使用GITLAB持续集成。这是从.gitlab-ci.yml来的:

    variables:
      MSSQL_HOST: microsoft-mssql-server-linux
      ACCEPT_EULA: Y
      SA_PASSWORD: StrongPass1234
      
    services:
      - microsoft/mssql-server-linux
    
    image: mcr.microsoft.com/dotnet/core/sdk:3.1
    
    stages:
        - build_models_api
        
    build_models_api:
        stage: build_models_api
        script:
            - "cd /builds/Myproject/APP/AppManagement.Api"
            - "dotnet restore"
            - "dotnet build"
            - "dotnet tool install --global dotnet-ef"
            - "export PATH='$PATH:/root/.dotnet/tools'"
            - "dotnet-ef migrations add initialmigration"
            - "dotnet-ef database update"

但是命令dotnet-ef migrations add initialmigration返回以下错误:no such file or directory

$ export PATH='$PATH:/root/.dotnet/tools'
$ dotnet-ef migrations add initialmigration
System.ComponentModel.Win32Exception (2): No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.EntityFrameworkCore.Tools.Exe.Run(String executable, IReadOnlyList`1 args, String workingDirectory, Boolean interceptOutput)
   at Microsoft.EntityFrameworkCore.Tools.Project.FromFile(String file, String buildExtensionsDir, String framework, String configuration, String runtime)
   at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute()
   at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0()
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
No such file or directory
ERROR: Job failed: exit code 1

有人遇到过这样的错误吗?谢谢您的帮助。

0 个答案:

没有答案