Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43356

MSBuild command fails in Jenkinsfile

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Blocker
    • Resolution: Unresolved
    • Component/s: msbuild-plugin
    • Labels:
      None
    • Environment:
      Windows
    • Similar Issues:

      Description

      This is my Jenkinsfile that's saved in my git repository, whenever I run a new Jenkins Build, it immediately fails with the trailing error, yet the msbuild command is correct, it runs fine from the command line. Any help would be appreciated.

       

      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'
      }

      }
      }

       

      Error:
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 14: expecting '}', found '/' @ line 14, column 84.
      \msbuild.exe" eSignWebApp.sln /noautorsp
      ^

      1 error

      at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
      at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
      at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
      at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:360)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:145)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:111)
      at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:237)
      at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:167)
      at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
      at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
      at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
      at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:430)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:393)
      at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:238)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:404)
      Finished: FAILURE

        Attachments

          Activity

          Hide
          rachel Rachel M. added a comment -

          Hi Ninos Denkha,

          I don't know if your Jenkinsfile is correctly copy-paste, but it seems you need to complete this path:

          "C:
          Program Files (x86)\\MSBuild\\14.0\\Bin
          msbuild.exe"
          

          In order to avoid problems, try to add msbuild.exe in your PATH. In that case, you will only need to specify:

          bat "msbuild.exe ... /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"

          Take care with quotes. In your code, they are after msbuild.exe and I think they must be placed after the last parameter.

          And finally, another option:

          I hope it will be useful.

          Show
          rachel Rachel M. added a comment - Hi Ninos Denkha , I don't know if your Jenkinsfile is correctly copy-paste, but it seems you need to complete this path: "C: Program Files (x86)\\MSBuild\\14.0\\Bin msbuild.exe" In order to avoid problems, try to add msbuild.exe in your PATH. In that case, you will only need to specify: bat "msbuild.exe ... /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}" Take care with quotes. In your code, they are after msbuild.exe and I think they must be placed after the last parameter. And finally, another option: Configure the plugin: https://wiki.jenkins-ci.org/display/JENKINS/MSBuild+Plugin Example of use: https://github.com/jenkinsci/pipeline-examples/blob/master/jenkinsfile-examples/msbuild/Jenkinsfile I hope it will be useful.

            People

            Assignee:
            marshall777 Lionel Cabasson
            Reporter:
            ndenkha Ninos Denkha
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: