Ric*_*ain 5 .net teamcity entity-framework-migrations
当前设置:
我正在使用以下命令设置构建任务以生成 SQL 迁移脚本:
dotnet ef migrations script --output "script.sql" --context MyContext
Run Code Online (Sandbox Code Playgroud)
但是,在 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
Run Code Online (Sandbox Code Playgroud)
如果我通过 TeamCity 服务器上的 Ubuntu shell 运行该命令,它运行时没有问题,但是通过 TeamCity 本身运行它时,我收到上述错误消息。我需要告诉 TeamCitydotnet安装在哪里吗?如果是在哪里?
构建步骤设置如下:
跑步者类型:命令行
运行:自定义脚本
自定义脚本:dotnet ef migrations script --output "script.sql" --context MyContext
TeamCity 现在支持使用其 .NET 运行程序运行自定义“dotnet”命令,但是其文档并不是特别清晰。您不需要为“可执行文件”字段指定任何值,因为假定为“dotnet”,而是将所有其他参数放入“命令行参数”字段中,如下所示。