MSbuild Setup:

      Jenkinsfile snippet:

              stage('Build') {
                  steps {
                      echo 'Building..'
                      bat "\"${tool 'MSBuild'}\" ${SQLPROJ} /p:Configuration=Release /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
                  }
              }
      

      Console output:

      {{D:\var\lib\jenkins\workspace\VisionPipeline>"c:\program files (x86)\msbuild\14.0\bin\" TBSM.Vision.Database\TBSM.Vision.Database\Vision.sqlproj /p:Configuration=Release /p:Platform="Any CPU" /p:ProductVersion=1.0.0.11
      '"c:\program files (x86)\msbuild\14.0\bin\"' is not recognized as an internal or external command,
      operable program or batch file.
      ??}}

      Do I have to specify msbuild.exe in the tool specification, above (that works, btw)? Or, is there a better way?

      Also, when will MSBuild be a first-class citizen in Pipeline (so we don't have to use bat to call it)

          [JENKINS-56389] MSBuild fails in Declarative Pipeline

          Gerald Britton created issue -
          Gerald Britton made changes -
          Summary Original: MSBuild fails in Declaritive Pipeline New: MSBuild fails in Declarative Pipeline
          Gerald Britton made changes -
          Description Original: MSbuild Setup:

           !image-2019-03-04-10-18-04-103.png|thumbnail!

          Jenkinsfile snippet:


          {code:java}
                  stage('Build') {
                      steps {
                          echo 'Building..'
                          bat "\"${tool 'MSBuild'}\" ${SQLPROJ} /p:Configuration=Release /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
                      }
                  }
          {code}

          Console output:

          {{D:\var\lib\jenkins\workspace\VisionPipeline>"c:\program files (x86)\msbuild\14.0\bin\" TBSM.Vision.Database\TBSM.Vision.Database\Vision.sqlproj /p:Configuration=Release /p:Platform="Any CPU" /p:ProductVersion=1.0.0.11
          '"c:\program files (x86)\msbuild\14.0\bin\"' is not recognized as an internal or external command,
          operable program or batch file.
          ??}}

          Do I have to specify msbuild.exe in the tool specification, above? Or, is there a better way?

          Also, when will MSBuild be a first-class citizen in Pipeline (so we don't have to use bat to call it)
          New: MSbuild Setup:

          !image-2019-03-04-10-18-04-103.png|thumbnail!

          Jenkinsfile snippet:
          {code:java}
                  stage('Build') {
                      steps {
                          echo 'Building..'
                          bat "\"${tool 'MSBuild'}\" ${SQLPROJ} /p:Configuration=Release /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
                      }
                  }
          {code}
          Console output:

          {{D:\var\lib\jenkins\workspace\VisionPipeline>"c:\program files (x86)\msbuild\14.0\bin\" TBSM.Vision.Database\TBSM.Vision.Database\Vision.sqlproj /p:Configuration=Release /p:Platform="Any CPU" /p:ProductVersion=1.0.0.11
           '"c:\program files (x86)\msbuild\14.0\bin\"' is not recognized as an internal or external command,
           operable program or batch file.
           ??}}

          Do I have to specify msbuild.exe in the tool specification, above (that works, btw)? Or, is there a better way?

          Also, when will MSBuild be a first-class citizen in Pipeline (so we don't have to use bat to call it)
          Gerald Britton made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]
          karthik Kumar BA made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]

          same error I am also facing anyone can help me regarding msbuild

          karthik Kumar BA added a comment - same error I am also facing anyone can help me regarding msbuild

          the same error I got unable to fix please can you help me on msbuild with declarative pipeline

          karthik Kumar BA added a comment - the same error I got unable to fix please can you help me on msbuild with declarative pipeline
          karthik Kumar BA made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          karthik Kumar BA made changes -
          Attachment New: screenshot-1.png [ 51216 ]
          karthik Kumar BA made changes -
          Attachment Original: screenshot-1.png [ 51216 ]

            marshall777 Lionel Cabasson
            gbritton Gerald Britton
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: