Jenkins can't find msbuild

久未见 提交于 2019-12-03 11:55:33
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)

  1. Right-click on Jenkins service and select "Properties"
  2. On the "Log On" tab, run as "Local System account" and tick the "Allow service to interact with desktop" checkbox

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

Fred Jand

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:

  1. Open the configuration for the node that has msbuild on it
  2. In the Labels field add msbuild
  3. Save the node configuration
  4. Open the job configuration
  5. Just above the Advanced Project Options section find the Restrict where this project can run checkbox and check it
  6. In the Label expression field add msbuild
  7. Save the job
  8. Build the job

Well

  • Does C:\Windows\Microsoft.NET\Framework\v3.5\ exist on Master server?
  • Does the Jenkins user have permissions to this folder?
StevenGodin

I also see the "...is not a directory on the Jenkins master..." error message, but when I try to build it works anyway.

Don't forget to select the MS Build version for your project instead of (default).

See: build .net application in Jenkins using MSBuild

Looks like this issue has been resolved in the 1.26 release: JENKINS-28679

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!