当前配置:
- 服务器运行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