• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • msbuild-plugin
    • None
    • Windows

      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

          [JENKINS-43356] MSBuild command fails in Jenkinsfile

          Ninos Denkha created issue -
          Ninos Denkha made changes -
          Description Original: 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 /v:n /t:clean,rebuild /p:Configuration=Debug /v:m /p:ProductVersion=1.0.0.$\{env.BUILD_NUMBER}" /p:VisualStudioVersion=14.0 /clp:Summary;ErrorsOnly;WarningsOnly
           }
           }
           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
          New: 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
          Rachel M. made changes -
          Comment [ Hi [~ndenkha],

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

           
          {noformat}
          "C:
          Program Files (x86)\\MSBuild\\14.0\\Bin
          msbuild.exe"
          {noformat}
          In order to avoid problems, try to add msbuild.exe in your PATH. In that case, you will only need to specify:
          {noformat}
          bat "msbuild.exe ... /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"{noformat}
          Take care with quotes. In your code, they are after msbuild.exe and I think they must be placed after the last parameter.

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

            ]
          Rachel M. made changes -
          Comment [ Hi [~ndenkha],

          I don't know if your Jenkinsfile is correctly copy-paste, but it seems you need to complete this path:
          {noformat}
          "C:
          Program Files (x86)\\MSBuild\\14.0\\Bin
          msbuild.exe"
          {noformat}
          In order to avoid problems, try to add msbuild.exe in your PATH. In that case, you will only need to specify:
          {noformat}
          bat "msbuild.exe ... /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"{noformat}
          Take care with quotes. In your code, they are after msbuild.exe and I think they must be placed after the last parameter.

          An 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. ]
          Michael Fowler made changes -
          Labels Original: msbuild
          Tilo made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

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

              Created:
              Updated:
              Resolved: