gpt4 book ai didi

.net - 无法将自定义 dotnet 命令作为 TeamCity 构建步骤运行

转载 作者:行者123 更新时间:2023-12-04 11:45:34 24 4
gpt4 key购买 nike

当前设置:

  • 服务器运行 Ubuntu 18
  • TeamCity Professional 2019.2(内部版本 71499)

  • 我正在使用以下命令设置构建任务以生成 SQL 迁移脚本:
    dotnet ef migrations script --output "script.sql" --context MyContext
    但是,在 TeamCity 上运行构建时,构建失败并显示以下错误:
    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.

    Process exited with code 1
    如果我通过 TeamCity 服务器上的 Ubuntu shell 运行该命令,它可以正常运行,但是通过 TeamCity 本身运行它时,我会收到上述错误消息。我需要告诉 TeamCity 在哪里 dotnet安装了吗?如果是在哪里?
    构建步骤设置如下:
    转轮类型 : 命令行
    运行 : 自定义脚本
    自定义脚本 : dotnet ef migrations script --output "script.sql" --context MyContext

    最佳答案

    TeamCity 现在支持运行自定义 "dotnet"然而,使用他们的 .NET runner 命令,他们的文档并不是特别清楚。您不需要为 指定任何值。 “可执行文件”字段为 "dotnet"假设,而是将所有附加参数放入 “命令行参数”字段如下图。
    enter image description here

    关于.net - 无法将自定义 dotnet 命令作为 TeamCity 构建步骤运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59610750/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com