0
這是我的Jenkinsfile,我在Jenkins中安裝了MSBuild插件。下面的msbuild命令是正確的,因爲我可以從命令行運行它,但Jenkins一直在失敗。如果我刪除它在抱怨那麼失敗就下單,等參數...Jenkins無法運行MSBuild命令
Jenkinsfile(保存在git倉庫):
pipeline {
agent {
docker 'node:7.7.3'
}
stages {
stage('Build') {
steps {
bat echo 'Checking node.js version..'
bat echo 'node -v'
bat echo 'Restore nugets..'
bat 'nuget restore mySolution.sln'
bat echo 'Building..'
bat "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\msbuild.exe" mySolution.sln /noautorsp /ds /nologo /t:clean,rebuild /p:Configuration=Debug /v:m /p:VisualStudioVersion=14.0 /clp:Summary;ErrorsOnly;WarningsOnly /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}
}
}
stage('Test') {
steps {
bat echo 'Testing..'
}
}
stage('Deploy') {
steps {
bat echo 'Deploying....'
}
}
}
post {
success {
bat echo 'Pipeline Succeeded'
}
failure {
bat echo 'Pipeline Failed'
}
unstable {
bat echo 'Pipeline run marked unstable'
}
}
}
錯誤:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 14: expecting '}', found '/' @ line 14, column 84.
\msbuild.exe" mySolution.sln /noautorsp
^
您可能需要避開斜槓。你可以嘗試在第14行的完整命令中加單引號嗎?像這樣:bat'command' –
同樣的確切問題。 – Ninos