Jenkins can't find msbuild

Lawrence Phillips picture Lawrence Phillips · Jun 4, 2014 · Viewed 24.3k times · Source

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

Answer

K. Alan Bates picture K. Alan Bates · Jul 12, 2015
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."

Save it anyway

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. Jenkins service

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.