如何在Windows Slave中的Groovy文件中运行长msbuild命令 [英] How to run long msbuild command in groovy file in windows slave

查看:50
本文介绍了如何在Windows Slave中的Groovy文件中运行长msbuild命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下在本地工作的 msbuild deploy命令:

I have the below msbuild deploy command which is working local:

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 ......."

what is correct syntax to run it in jenkisfile.groovy? I'm running against my windows machine, so I guess it should start with bat "msbuild ......."

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

I tried many syntax but they all failed

推荐答案

我建议您进行多行处理,以具有更大的灵活性和自由性

I'd advise to go multiline then, to have more flexibility and freedom

bat (
    label: 'Run Tests',
    script: """
        set ASPNETCORE_ENVIRONMENT=Pipeline
        dotnet test
        if errorlevel 1 exit /b 1
    """
)

请注意,对于多行,您必须跟踪每行的退出代码,因此,虽然在此处没有必要,但您可以以此拆分其他行,以确保在第一次失败时停止构建.

Note that for multiline you have to keep track of exit code of every line, so while it is not necessary here, you can split your other lines by this to make sure build stops on a first failure.

这篇关于如何在Windows Slave中的Groovy文件中运行长msbuild命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆