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

MSBuild Command Line Arguments quotes being stripped...not 5552

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Blocker
    • Resolution: Fixed
    • msbuild-plugin
    • None
    • Windows 7/2008

    Description

      I've been following JENKINS-5552 and this seems to be a different, but same issue. No matter what I put in the Command Line Arguments section of the "Build a Visual Studio project of solution using MSBuild" the command is parsed and the quotes needed are stripped. Since we have to use devenv.com, I cannot use the /p: command parameters. Attempting to us /build "Release|Win32" results in the quotes being stripped. This only happens when there are no spaces. "Release|Any CPU" appears to get the quotes re-established as the tokenizer recognizes the space. Can we just have this field get passed verbatim?

      Attachments

        Activity

          agallant Andrew Gallant created issue -

          I had the same problem, that the quotes were being stripped from /p:Configuration="Release|x86". I believe the solution is to specifically use instantiate QuoteStringTokenizer instances that return the quotes instead of relying on ArgumentListBuilder.addTokenized() (which will strip the quotes).
          I've committed the changes to a fork and have submitted a pull request.

          tyrius Jonathan Zimmerman added a comment - I had the same problem, that the quotes were being stripped from /p:Configuration="Release|x86". I believe the solution is to specifically use instantiate QuoteStringTokenizer instances that return the quotes instead of relying on ArgumentListBuilder.addTokenized() (which will strip the quotes). I've committed the changes to a fork and have submitted a pull request.

          Updated MSBUILD plugin 1.17 still stripping out quotes.

          Thanks!
          Andy

          agallant Andrew Gallant added a comment - Updated MSBUILD plugin 1.17 still stripping out quotes. Thanks! Andy
          tyrius Jonathan Zimmerman added a comment - - edited

          I've created a patch for this: https://github.com/jenkinsci/msbuild-plugin/pull/7. The patch bumps the parent version to 1.420 because of a problem compiling with Java 7.

          tyrius Jonathan Zimmerman added a comment - - edited I've created a patch for this: https://github.com/jenkinsci/msbuild-plugin/pull/7 . The patch bumps the parent version to 1.420 because of a problem compiling with Java 7.

          Any idea when this will be available as an update?

          Thanks,
          AJ

          agallant Andrew Gallant added a comment - Any idea when this will be available as an update? Thanks, AJ

          I'm not sure. I'll reach out to the maintainers to see if we can get this pulled in and released.

          tyrius Jonathan Zimmerman added a comment - I'm not sure. I'll reach out to the maintainers to see if we can get this pulled in and released.
          sogabe sogabe added a comment -

          @gboissinot Would you merge pull/7 and release this plugin?

          sogabe sogabe added a comment - @gboissinot Would you merge pull/7 and release this plugin?
          sogabe sogabe made changes -
          Field Original Value New Value
          Assignee kdsweeney [ kdsweeney ] Gregory Boissinot [ gbois ]

          Code changed in jenkins
          User: Jonathan Zimmerman
          Path:
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          src/test/java/hudson/plugins/msbuild/MsBuildBuilderTest.java
          http://jenkins-ci.org/commit/msbuild-plugin/11525049ed173f941d6ec6e87694269ef40d9920
          Log:
          JENKINS-17876 Directly invoke QuotedStringTokenizer so quotes can be preserved in both the installation default args and the instance args.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jonathan Zimmerman Path: src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java src/test/java/hudson/plugins/msbuild/MsBuildBuilderTest.java http://jenkins-ci.org/commit/msbuild-plugin/11525049ed173f941d6ec6e87694269ef40d9920 Log: JENKINS-17876 Directly invoke QuotedStringTokenizer so quotes can be preserved in both the installation default args and the instance args.

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          pom.xml
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          src/test/java/hudson/plugins/msbuild/MsBuildBuilderTest.java
          http://jenkins-ci.org/commit/msbuild-plugin/0ae0e878b29ff22072286e65fc198f32a0cdb46c
          Log:
          Merge pull request #7 from tyrius02/master

          [FIXED JENKINS-17876] Use QuotedStringTokenizer when constructing msbuild command-line arguments

          Compare: https://github.com/jenkinsci/msbuild-plugin/compare/dbf9ee71a1a5...0ae0e878b29f

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: pom.xml src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java src/test/java/hudson/plugins/msbuild/MsBuildBuilderTest.java http://jenkins-ci.org/commit/msbuild-plugin/0ae0e878b29ff22072286e65fc198f32a0cdb46c Log: Merge pull request #7 from tyrius02/master [FIXED JENKINS-17876] Use QuotedStringTokenizer when constructing msbuild command-line arguments Compare: https://github.com/jenkinsci/msbuild-plugin/compare/dbf9ee71a1a5...0ae0e878b29f
          scm_issue_link SCM/JIRA link daemon made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          damiandixon damian dixon added a comment -

          It looks like this fix has introduced a problem with the following command line:

          /p:"VCBuildAdditionalOptions=/M20" /p:Configuration="Debug for Release" /p:platform="Win32" /v:n

          This ends up thus:

          cmd.exe /C C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe /p:"VCBuildAdditionalOptions=/M20" '/p:Configuration="Debug for Release"' /p:platform="Win32" /v:n C:\hudson\config\jobs\MapLink-Checkout\workspace\SDK\ThirdParty\Xalan-C\Xalan-Cx.sln && exit

          Giving the following error:

          MSBUILD : error MSB1008: Only one project can be specified.
          Switch: Release

          damiandixon damian dixon added a comment - It looks like this fix has introduced a problem with the following command line: /p:"VCBuildAdditionalOptions=/M20" /p:Configuration="Debug for Release" /p:platform="Win32" /v:n This ends up thus: cmd.exe /C C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe /p:"VCBuildAdditionalOptions=/M20" '/p:Configuration="Debug for Release"' /p:platform="Win32" /v:n C:\hudson\config\jobs\MapLink-Checkout\workspace\SDK\ThirdParty\Xalan-C\Xalan-Cx.sln && exit Giving the following error: MSBUILD : error MSB1008: Only one project can be specified. Switch: Release

          I have the same issue as Damian.

          I think the problem come from spaces in parameter values. Like for Damian, one of my parameters contains spaces and it's surrounded by quotes (') in the command line.
          I have the same error message: Only one project can be specified.

          To solve the issue, I have to roll back to previous version of the plugin (1.15).

          Regards,
          François

          franlero François Le Rolland added a comment - I have the same issue as Damian. I think the problem come from spaces in parameter values. Like for Damian, one of my parameters contains spaces and it's surrounded by quotes (') in the command line. I have the same error message: Only one project can be specified. To solve the issue, I have to roll back to previous version of the plugin (1.15). Regards, François
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 149172 ] JNJira + In-Review [ 193006 ]

          People

            gbois Gregory Boissinot
            agallant Andrew Gallant
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: