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

Add support of vcvarsall.bat VC compilation environment variable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • msbuild-plugin
    • None

      Before MSBuild compilation some predefined environment variable are needed like:
      "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64

      in order to succeed an MSBuild on project or Solution, allowing a pre-command line before calling MSBuild will be great.

      Thanks

          [JENKINS-16452] Add support of vcvarsall.bat VC compilation environment variable

          Vincent Bailleau created issue -

          Sungje hong added a comment -

          Is there any alternative method before it is fixed?

          Sungje hong added a comment - Is there any alternative method before it is fixed?

          Mark Waite added a comment -

          Since our Windows compilation environment always requires vcvarsall.bat, and since our experience with Jenkins slaves as a service has been very bad, we configure a batch file that starts the Jenkins slave agent. Before starting the Jenkins slave agent, the batch file sets environment variables for various needs. Things like:

          CALL "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"

          SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21
          SET ANT_HOME=C:\apache-ant-1.9.0

          SET PATH=tools;C:\Program Files (x86)\Git\bin;%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%

          javaws javaws http://172.16.16.254:8080/computer/%COMPUTERNAME%/slave-agent.jnlp

          Mark Waite added a comment - Since our Windows compilation environment always requires vcvarsall.bat, and since our experience with Jenkins slaves as a service has been very bad, we configure a batch file that starts the Jenkins slave agent. Before starting the Jenkins slave agent, the batch file sets environment variables for various needs. Things like: CALL "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21 SET ANT_HOME=C:\apache-ant-1.9.0 SET PATH=tools;C:\Program Files (x86)\Git\bin;%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH% javaws javaws http://172.16.16.254:8080/computer/%COMPUTERNAME%/slave-agent.jnlp

          Terry Rankine added a comment -

          I would like to see something similar, but I am not sure 'configure jenkins' (the global config) is the right spot to place TOOLSET configurations when they are node specific.... (can be installed anywhere on the node)

          Mark - how do you call the vars when jenkins is running as a windows service.

          Terry Rankine added a comment - I would like to see something similar, but I am not sure 'configure jenkins' (the global config) is the right spot to place TOOLSET configurations when they are node specific.... (can be installed anywhere on the node) Mark - how do you call the vars when jenkins is running as a windows service.

          Mark Waite added a comment -

          We don't run Jenkins as a Windows service. Running Jenkins slaves as a Windows service creates several problems which are showstoppers in our environment.

          Some of our tests need to run on the Windows desktop (Selenium, exe playback tests, etc.).

          Other of our tests need access to the desktop environment, even if they don't display on the desktop (using the desktop to pass messages between apps, etc.).

          It has been much simpler for us to configure "auto-login" on our slave agents and add a batch file to startup to launch the Jenkins slave agent rather than attempt to configure a service which can interact with the desktop and behave as though it were a desktop.

          It also seems more "natural" to me that I should not alter a Windows service to have desktop access. I think that Windows services are generally not intended to access the desktop, and tests which need to run as a service should not have desktop access.

          Mark Waite added a comment - We don't run Jenkins as a Windows service. Running Jenkins slaves as a Windows service creates several problems which are showstoppers in our environment. Some of our tests need to run on the Windows desktop (Selenium, exe playback tests, etc.). Other of our tests need access to the desktop environment, even if they don't display on the desktop (using the desktop to pass messages between apps, etc.). It has been much simpler for us to configure "auto-login" on our slave agents and add a batch file to startup to launch the Jenkins slave agent rather than attempt to configure a service which can interact with the desktop and behave as though it were a desktop. It also seems more "natural" to me that I should not alter a Windows service to have desktop access. I think that Windows services are generally not intended to access the desktop, and tests which need to run as a service should not have desktop access.

          Mark Waite added a comment -

          Rather than using the MSBuild launcher, you could run use a batch file within the job, and call vcvarsall.bat from that batch file, then call msbuild from within the batch file.

          Mark Waite added a comment - Rather than using the MSBuild launcher, you could run use a batch file within the job, and call vcvarsall.bat from that batch file, then call msbuild from within the batch file.

          David Aldrich added a comment -

          I have struggled with this issue this week. It seems to me that, for users who run Jenkins as a service on Windows, the MSBuild plugin needs to support vcvarsall.bat. Meanwhile, I am just running MSBuild from a Windows Batch Step, which defeats the point of having the plugin.

          A contribution on the mailing list suggested putting the contents of vcvarsall.bat into a properties file and applying it using the Environment Injector Plugin for use by the MSBuild plugin. I haven't tried that.

          May I suggest that, at least, some guidance is given on the MSBuild plugin wiki page about this issue?

          David Aldrich added a comment - I have struggled with this issue this week. It seems to me that, for users who run Jenkins as a service on Windows, the MSBuild plugin needs to support vcvarsall.bat. Meanwhile, I am just running MSBuild from a Windows Batch Step, which defeats the point of having the plugin. A contribution on the mailing list suggested putting the contents of vcvarsall.bat into a properties file and applying it using the Environment Injector Plugin for use by the MSBuild plugin. I haven't tried that. May I suggest that, at least, some guidance is given on the MSBuild plugin wiki page about this issue?
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 147274 ] New: JNJira + In-Review [ 176857 ]

          Nathan Osman added a comment -

          This is now possible with the help of a plugin I have created: https://wiki.jenkins-ci.org/display/JENKINS/vcvarsall+Plugin

          Nathan Osman added a comment - This is now possible with the help of a plugin I have created: https://wiki.jenkins-ci.org/display/JENKINS/vcvarsall+Plugin

          Mark Waite added a comment -

          Thanks very much, Nathan! I don't see the plugin in the update center on my local Jenkins, even when I refresh. I also don't see it on https://updates.jenkins-ci.org/download/plugins/ .

          Have you requested hosting of the vcvarsall plugin?

          Is there a location where I can find the source code so that I can compile it myself before it is available from the update center?

          Mark Waite added a comment - Thanks very much, Nathan! I don't see the plugin in the update center on my local Jenkins, even when I refresh. I also don't see it on https://updates.jenkins-ci.org/download/plugins/ . Have you requested hosting of the vcvarsall plugin? Is there a location where I can find the source code so that I can compile it myself before it is available from the update center?

            kdsweeney kdsweeney
            zucher Vincent Bailleau
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: