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

MSBuild is unable to build projects in a different directory

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • msbuild-plugin
    • MS Windows Server 2008

      I use SVN to checkout a project to .\proj and a dependency to .\dep. The .sln file is at .\proj\proj.sln. I us the MsBuild plugin with the setting "MsBuild Build File" = "proj\proj.sln" (or a number of variants such as .\proj\proj.sln). Msbuild fails with MSB1009: Project file does not exist. However, running a similar command manually succeeds.

        1. betterbuild.txt
          12 kB
        2. badbuild.txt
          2 kB
        3. badconfig.PNG
          badconfig.PNG
          12 kB
        4. goodbuild.txt
          13 kB
        5. goodconfig.PNG
          goodconfig.PNG
          47 kB

          [JENKINS-13863] MSBuild is unable to build projects in a different directory

          Aaron Laws created issue -

          MSBuild Jenkins plugin only builds the MSBuild command line and the plugin executes this generated command line.
          What is the issue?

          Gregory Boissinot added a comment - MSBuild Jenkins plugin only builds the MSBuild command line and the plugin executes this generated command line. What is the issue?

          Aaron Laws added a comment -

          I'm not sure what the problem is. I can reproduce it reliably, though. If the solution file is in a child directory of the PWD, I cannot build the project directly using the msbuild plugin, but must add a build step before msbuild to change the PWD (something like cd proj). Perhaps some sample output is helpful.

          Aaron Laws added a comment - I'm not sure what the problem is. I can reproduce it reliably, though. If the solution file is in a child directory of the PWD, I cannot build the project directly using the msbuild plugin, but must add a build step before msbuild to change the PWD (something like cd proj ). Perhaps some sample output is helpful.

          Aaron Laws added a comment -

          Attached are a screen shot of a configuration that works and one that ought to work but doesn't along with both outputs in text format.

          Aaron Laws added a comment - Attached are a screen shot of a configuration that works and one that ought to work but doesn't along with both outputs in text format.
          Aaron Laws made changes -
          Attachment New: goodconfig.PNG [ 21897 ]
          Attachment New: badconfig.PNG [ 21898 ]
          Attachment New: badbuild.txt [ 21899 ]
          Attachment New: goodbuild.txt [ 21900 ]

          Do you know a command line argument for msbuild to specify another path?

          Gregory Boissinot added a comment - Do you know a command line argument for msbuild to specify another path?

          Aaron Laws added a comment - - edited

          I should have attached this earlier. There's no command line argument, just specify the path to the project as the project file argument. Please see "betterbuild.txt" which I just ran by hand from the command line.

          Aaron Laws added a comment - - edited I should have attached this earlier. There's no command line argument, just specify the path to the project as the project file argument. Please see " betterbuild.txt " which I just ran by hand from the command line.
          Aaron Laws made changes -
          Attachment New: betterbuild.txt [ 21907 ]

          Josselin Vallet added a comment - - edited

          I had the same issue,

          I solved this by using the environment variable WORKSPACE and setting the solution path to "%WORKSPACE%\proj\proj.sln".

          Josselin Vallet added a comment - - edited I had the same issue, I solved this by using the environment variable WORKSPACE and setting the solution path to "%WORKSPACE%\proj\proj.sln".

          Aaron Laws added a comment -

          Josselin Vallet , that workaround works, although I wouldn't call it a solution. Thanks for the advice!

          Aaron Laws added a comment - Josselin Vallet , that workaround works, although I wouldn't call it a solution. Thanks for the advice!

            kdsweeney kdsweeney
            limited_atonement Aaron Laws
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: