如何在windows slave中的groovy文件中运行长msbuild命令

如何在windows slave中的groovy文件中运行长msbuild命令,windows,groovy,msbuild,jenkins-pipeline,Windows,Groovy,Msbuild,Jenkins Pipeline,我有下面的msbuilddeploy命令,它在本地工作: msbuild "Database Services\Database Services.sqlproj" /t:deploy /p:TargetConnectionString="Data Source=TEST,111;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=Fa

我有下面的
msbuild
deploy命令,它在本地工作:

msbuild "Database Services\Database Services.sqlproj" /t:deploy /p:TargetConnectionString="Data Source=TEST,111;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False" /p:BlockOnPossibleDataLoss=False /p:TargetDatabase="test_db"
在jenkisfile.groovy中运行它的正确语法是什么? 我正在运行我的windows计算机,所以我想它应该以
bat“msbuild…”开头


我尝试了许多语法,但都失败了

我建议使用多行,以获得更大的灵活性和自由度

bat ' msbuild "Database Services\\Database Services.sqlproj" /t:deploy /p:TargetConnectionString="Data Source=TEST,111;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False" /p:BlockOnPossibleDataLoss=False /p:TargetDatabase="test_db" '
bat(
标签:“运行测试”,
脚本:“”
设置ASPNETCORE\u环境=管道
网络测试
如果错误级别1退出/b 1
"""
)
请注意,对于多行,您必须跟踪每一行的退出代码,因此,虽然这里不需要这样做,但您可以按此拆分其他行,以确保在第一次失败时停止构建