8

I run MSys/Bash as distributed in Git for Windows. I added the folder C:\Windows\Microsoft.NET\Framework\v4.0.30319 to my path, so I could run msbuild but it doesn't work

$ msbuild
C:\Program Files (x86)\Git\bin\sh.exe: msbuild: command not found

Yet msbuild.exe does:

$ msbuild.exe
Microsoft (R) Build Engine version 4.0.30319.17929

Yet the command explorer resolves fine. What's going on?

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465

3 Answers3

17

It's a bug in MSys where the same name is shared by a folder and a file (minus the extension). In this case:

  • File C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
  • Folder C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild

You'll have to workaround by writing msbuild.exe

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
  • 3
    You can also work around this by making a link named `msbuild` to `msbuild.exe`, in a directory that precedes the `...\Framework\v4.0.30319` directory in `PATH`. – danwyand Jan 30 '14 at 19:39
0

If the exe file outputs not found, do copy C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ProjectPath
And then run msbuild.exe

berriz44
  • 62
  • 1
  • 1
  • 13
-1

If msbuild.exe cannot be found, it needs to be configured.

Open a command prompt and run the file vsvars32.bat located in your Visual Studio Common7/Tools folder..

i.e C:\Program Files x86\Microsoft Visual Studio 12.0\Common7\Tools\vsvars32.bat

This will correctly setup all the neccessary variables for msbuild.exe to be found.

Greg Quinn
  • 1,927
  • 1
  • 23
  • 26
  • This is not working on my Windows 8.1 with Visual Studio 2013. There is also no output from the vsvars32.bat?! I have tried it also with a admin shell without success. – Sebastian Aug 14 '14 at 06:18
  • 1
    For me, it's now located on `C:\Program Files\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\ext`. – Earlee Apr 30 '21 at 03:34