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

New MSBuild release has a space in the installation path; causes msbuild plugin to fail

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: msbuild-plugin
    • Labels:
      None
    • Environment:
      MSBuild 12.0 -- this is now distributed as a separate package, instead of being included with the dot-net framework
      Windows 2012
      Jenkins MSBuild Plugin 1.21
    • Similar Issues:

      Description

      The installation location for the new MSBuild release has a space in the path.

      If I put quotes around the path to MSBuild in system configuration ("C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"), this error occurs:

      FATAL: "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" doesn't exist
      Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure

      Without quotes in the system configuration, but with a command-line parameter that includes quotes (/p:Platform="Mixed Platforms"), this happens:

      Path To MSBuild.exe: C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe
      Executing the command cmd.exe /C "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "/p:Platform=Mixed Platforms" src/Build.proj && exit %%ERRORLEVEL%% from C:\jenkins\workspace\wintest
      [wintest] $ cmd.exe /C "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "/p:Platform=Mixed Platforms" src/Build.proj && exit %%ERRORLEVEL%%
      'C:\Program' is not recognized as an internal or external command,
      operable program or batch file.
      Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure

        Attachments

          Activity

          Hide
          dginga Dick Ginga added a comment -

          I have hit this also with a path to the solution file containing a space

          Show
          dginga Dick Ginga added a comment - I have hit this also with a path to the solution file containing a space
          Hide
          istrathdee Ian Strathdee added a comment -

          Same here, exact same messages in Description received on my end trying to utilize msbuild for .net 4.5.1. Attempting to build a solution.

          Show
          istrathdee Ian Strathdee added a comment - Same here, exact same messages in Description received on my end trying to utilize msbuild for .net 4.5.1. Attempting to build a solution.
          Hide
          mnieto Miguel Nieto added a comment -

          As a work arround, you can setup the PATH environment variable to add the path to MSBuild. Then, in the project configuration, select the Default MSBuild version.

          Show
          mnieto Miguel Nieto added a comment - As a work arround, you can setup the PATH environment variable to add the path to MSBuild. Then, in the project configuration, select the Default MSBuild version.
          Hide
          tbojer Thorsten Bojer added a comment -

          I had also this problem.
          Changing
          if (!launcher.isUnix())

          { args.prepend("cmd.exe", "/C"); args.add("&&", "exit", "%%ERRORLEVEL%%"); }

          to
          if (!launcher.isUnix())

          { args.prepend("cmd.exe", "/C", "\""); args.add("\"", "&&", "exit", "%%ERRORLEVEL%%"); }

          resolved the problem for me.
          This add additional quotes to the command line, so that the all parameters acts as a single Parameter for 'cmd /C'.

          Show
          tbojer Thorsten Bojer added a comment - I had also this problem. Changing if (!launcher.isUnix()) { args.prepend("cmd.exe", "/C"); args.add("&&", "exit", "%%ERRORLEVEL%%"); } to if (!launcher.isUnix()) { args.prepend("cmd.exe", "/C", "\""); args.add("\"", "&&", "exit", "%%ERRORLEVEL%%"); } resolved the problem for me. This add additional quotes to the command line, so that the all parameters acts as a single Parameter for 'cmd /C'.
          Hide
          vfreak Ross Inglis added a comment -

          What worked for me was using the short path. E.G.

          C:\PROGRA~2\MSBuild\12.0\Bin\MSBuild.exe

          (Use the DOS command "dir /X" to verify this name on your platform, it just 'might' be different)

          Show
          vfreak Ross Inglis added a comment - What worked for me was using the short path. E.G. C:\PROGRA~2\MSBuild\12.0\Bin\MSBuild.exe (Use the DOS command "dir /X" to verify this name on your platform, it just 'might' be different)
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Christopher Gross
          Path:
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          http://jenkins-ci.org/commit/msbuild-plugin/f72edcd8642832542c807db4939ec7c5bbab1a27
          Log:
          fix: msbuild can now be in a path containing spaces (fix provided via comment on JENKINS-22461 by Thorsten Bojer)

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christopher Gross Path: src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java http://jenkins-ci.org/commit/msbuild-plugin/f72edcd8642832542c807db4939ec7c5bbab1a27 Log: fix: msbuild can now be in a path containing spaces (fix provided via comment on JENKINS-22461 by Thorsten Bojer)
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          http://jenkins-ci.org/commit/msbuild-plugin/da904ff4b558ce6ca4ca14ada2eecc423a56d941
          Log:
          Merge pull request #15 from XitasoChris/master

          Fix: MSBuild can now be in a path containing spaces (JENKINS-22461)

          Compare: https://github.com/jenkinsci/msbuild-plugin/compare/635691a03d43...da904ff4b558

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java http://jenkins-ci.org/commit/msbuild-plugin/da904ff4b558ce6ca4ca14ada2eecc423a56d941 Log: Merge pull request #15 from XitasoChris/master Fix: MSBuild can now be in a path containing spaces ( JENKINS-22461 ) Compare: https://github.com/jenkinsci/msbuild-plugin/compare/635691a03d43...da904ff4b558

            People

            • Assignee:
              kdsweeney kdsweeney
              Reporter:
              cswarren cswarren
            • Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: