# Error while clicking on "build now" Please help me out on how to resolve this

**URL:** <https://community.jenkins.io/t/error-while-clicking-on-build-now-please-help-me-out-on-how-to-resolve-this/7925>\
**Category:** Using Jenkins\
**Tags:** question\
**Created:** [June 9, 2023, 2:19pm UTC](https://community.jenkins.io/t/error-while-clicking-on-build-now-please-help-me-out-on-how-to-resolve-this/7925 "2023-06-09T14:19:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![govindanupam](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@govindanupam](https://community.jenkins.io/u/govindanupam)\
**Post date:** [June 9, 2023, 2:19pm UTC](https://community.jenkins.io/t/error-while-clicking-on-build-now-please-help-me-out-on-how-to-resolve-this/7925/1 "2023-06-09T14:19:30Z")

</div>

Dear all,  
Request you to help me out on how to resolve below error which shown in my console output.

Console output:

The following environment variables were removed by ‘Only Keep Specified Environment Variables’: BUILD\_DISPLAY\_NAME, BUILD\_URL, CI, EXECUTOR\_NUMBER, HUDSON\_HOME, HUDSON\_URL, JENKINS\_URL, JOB\_DISPLAY\_URL, JOB\_URL, NODE\_LABELS, NODE\_NAME, RUN\_ARTIFACTS\_DISPLAY\_URL, RUN\_CHANGES\_DISPLAY\_URL, RUN\_DISPLAY\_URL, RUN\_TESTS\_DISPLAY\_URL, WORKSPACE, WORKSPACE\_TMP

C:\ProgramData\Jenkins.jenkins\workspace\test\>exit 0  
Path To MSBuild.exe: msbuild.exe  
Executing the command cmd.exe /C " chcp 1252 & msbuild.exe " && exit %%ERRORLEVEL%% from C:\ProgramData\Jenkins.jenkins\workspace\test  
[testgit] $ cmd.exe /C " chcp 1252 & msbuild.exe " && exit %%ERRORLEVEL%%  
Active code page: 1252  
‘msbuild.exe’ is not recognized as an internal or external command,  
operable program or batch file.  
Build step ‘Build a Visual Studio project or solution using MSBuild’ marked build as failure  
Finished: FAILURE

Thanks and regards

---

<div class="post-metadata">

**Author:** ![mawinter69](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mawinter69/32/1625_2.png) [@mawinter69](https://community.jenkins.io/u/mawinter69)\
**Post date:** [June 9, 2023, 2:29pm UTC](https://community.jenkins.io/t/error-while-clicking-on-build-now-please-help-me-out-on-how-to-resolve-this/7925/2 "2023-06-09T14:29:25Z")

</div>

ensure that msbuild.exe is found in the path

---

<div class="post-metadata">

**Author:** ![govindanupam](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@govindanupam](https://community.jenkins.io/u/govindanupam)\
**Post date:** [June 9, 2023, 6:31pm UTC](https://community.jenkins.io/t/error-while-clicking-on-build-now-please-help-me-out-on-how-to-resolve-this/7925/3 "2023-06-09T18:31:43Z")

</div>

Hi all,

thanks for your reply,

yes, pretty sure about the full file path under (Manage jenkins → Global Tool Configuration  
 → Path to MSBuild “MSBuild.exe full file path” )

please help me to go for next step.

thanks and regards

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [June 10, 2023, 1:35am UTC](https://community.jenkins.io/t/error-while-clicking-on-build-now-please-help-me-out-on-how-to-resolve-this/7925/4 "2023-06-10T01:35:00Z")

</div>

> [@govindanupam](#):
>
> ‘msbuild.exe’ is not recognized as an internal or external command,  
> operable program or batch file.

The tool (msbuild.exe) must be accessible at that path on the agent where you are running the tool. The error message says that msbuild.exe is not on the path from that agent.

You could diagnose to confirm that by creating a temporary job that runs on the specific agent and runs the Windows batch command `env`. That will list all the environment variables as configured on that agent. You will see that one of the variables is `PATH`. You will see that `PATH` on the agent does not include the location of `msbuild.exe`.

Configure the agent so that the directory that contains `msbuild.exe` is listed in the `PATH`.
