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

6

当前配置:

  • 服务器运行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安装在哪里?如果需要,应该在哪里设置?

构建步骤设置如下:

Runner Type: 命令行

Run: 自定义脚本

Custom script: dotnet ef migrations script --output "script.sql" --context MyContext


我也得到了相同的结果?还没有答案吗?太糟糕了! - Ravish Rawat
1个回答

0
TeamCity现在支持使用它们的.NET运行器运行自定义“dotnet”命令,但是他们的文档不是特别清晰。您不需要为“可执行文件”字段指定任何值,因为假定为“dotnet”,而所有其他参数都放置在下面所示的“命令行参数”字段中。

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接