msbuild.exe is not recognized command after build in Jenkins

For the latest version of jenkins (3.0), you have to configure MSBuild in in the Tools>Manage Jenkins menu. Name a job here eg: msbuild. Once that is done, go to the job. Under the MSBuild module select the build (in this case msbuild) and now kick off the job. You should be good to go.


For the newer version of Jenkins, this option is available under this section ..

Manage Jenkins -> Global Tool Configuration ->  MSBuild

From this answer: https://stackoverflow.com/a/37939483/2880781


If you want to build a .NET project using Jenkins, follow these steps:

  1. Install MsBuild Plugin

  2. Go to Jenkins -> Manage Jenkins -> Configure System (On newer versions: Jenkins -> Manage Jenkins -> Global Tool Configuration -> MSBuild) msbuild

  3. In the MSBuild section click the AddMsBuild button and specify the details:

    • Name: Name of the MsBuild
    • Path to MsBuild: Specify the path of msbuild.exe. Example: C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe
  4. Save and apply the changes.

  5. Select your job.

  6. Select Add Build Step.

  7. Select MsBuild version.

  8. Specify the path to the project file (.csproj or .sln)

msbuild in project

  1. Build your project.