I've installed Jenkins on Windows Server 2012, which all worked fine. However once I tried to configure the MSBuild and VS Code metrics plugins, I get the following error:
C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe is not a directory on the Jenkins master (but perhaps it exists on some slaves)
I've checked the paths and they are correct, but Jenkins can't access them.
Can anyone suggest what may be wrong.
Thanks
MSBuild is installed in the \Current folder under each version of Visual Studio, and the executables are in the \Bin subfolder.
From the Global tool configurations, you can setup MSBuild Configuration. Here, you have to copy the MSBuild.exe path from your system- Program files and paste it to Path to MSBuild textbox. Give a name for your MSBuild and now, apply and save the changes. Select a Freestyle project, click on ok.
Usage. To use this plugin, specify the location directory of MSBuild.exe on Jenkin's configuration page. The MSBuild executable is usually situated in a subfolder of C:\WINDOWS\Microsoft.NET\Framework.
Click on System and Security and then on System. In the left pane, click on Advanced system settings. At the very bottom of the pop up, click on Environment Variables. Edit the Path variable and append the folder's path that contains the MSBuild.exe to it (e.g., ;C:\Windows\Microsoft.NET\Framework64\v4.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe
Jenkins was very matter-of-factly lying to you with its requirements. MSBuild.exe
is an executable, not a directory just as it reports. The input box expects you to identify the folder containing MSBuild.exe but the Job that executes MSBuild expects you to have provided the file name. The way around this inconsistency between the Job and the Configuration Manager is to Add the MSBuild
plugin configuration without providing the name of the executable in the Path to MsBuild
input to satisfy the validation requirements of the "Add Plugin" page.
Once the Plugin has been added, you can modify the Path to MsBuild
to contain the name of the executable (which, of course, is MSBuild.exe
) and rather than a validation error, you will receive a warning.
Ignore the warning. Save it anyway.
It will bypass the initial validation that was required to Add the plug in and will "just work."
Your Jenkins service will likely still need to be granted access to the file system by "allowing it to interact with the desktop" as was mentioned by other posters.
But your primary problem is that the plug in configuration conflicts with the agent that consumes the configuration and in order to use the plugin to perform builds, you have to use a workaround.
I had the same problem, The solution for me was:
If you are running Jenkins as a Window's service, you will probably need to enable the service to interact with the desktop. Do the following:
Open the Services module (press: WindowsKey+R > Services.msc)
-- OR --
You can run simply run Jenkins via the command-line. Ie: "java -jar jenkins.war" (jenkins.war file is located in your Jenkins installation Directory).
Cheers,
J.
Remove the extension ".exe" from the end of the msbuild.exe in your path to avoid warnings: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild
.
So you have two servers with Jenkins, one a master (that doesn't have msbuild) and the other a slave (this one does have msbuild). When your job runs (on the master) the msbuild step fails because it doesn't exist on the master.
You need to force your job to only run on the server with msbuild, not the master. Here's how you do this:
msbuild
msbuild
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With