26

I'm trying to compile windows project from visual studio 2010 (64) on windows 7 in c++ from command line, but I can't find msbuild.exe, where is it?

greatwolf
  • 20,287
  • 13
  • 71
  • 105
Ivan Pericic
  • 522
  • 1
  • 8
  • 24

2 Answers2

35

It should be installed as part of .NET 4... so for example, in

c:\Windows\Microsoft.NET\Framework\v4.0.30319

... but if you start a "Visual Studio Command Prompt" instead of just running cmd, it should be in the path already. That's what I'd suggest you do - I always have Visual Studio Command Prompt as a shortcut pinned to my task bar; I have no reason to launch a command prompt which doesn't have the relevant path :)

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • 1
    If the Visual Studio command prompt also fails you probably need to remove any quotes surrounding entries in your path - see http://www.blinnov.com/en/2010/06/04/microsoft-was-unexpected-at-this-time/ – morechilli Nov 19 '12 at 08:40
  • Command "MSBuild.exe" is not valid. from Visual Studio 2013 Command Window, file is present at proper location. – Chaitanya Gadkari Sep 21 '15 at 14:03
  • @ChaitanyaGadkari: Not sure what you mean by "is not valid". This should be absolutely fine... – Jon Skeet Sep 21 '15 at 14:04
  • That is the Message i get from command window. (Command "MSBuild.exe" is not valid) – Chaitanya Gadkari Sep 21 '15 at 14:09
  • @ChaitanyaGadkari: Have you tried executing it with an absolute path name? Is everything else working? – Jon Skeet Sep 21 '15 at 14:11
  • yes, I am providing absolute path. Solution(It have two projects if that makes any difference) is working fine as such, but I have not used Command Window before, wanted to explore that. So I have no clue if there is problem with commands. – Chaitanya Gadkari Sep 21 '15 at 14:16
  • Okay, it sounds like something is badly broken, I'm afraid - you're trying to run the 64-bit version on a 32-bit machine, or something like that. You might want to ask a new question with the details in - it's not really suitable for this question, which was just about where msbuild.exe lives. – Jon Skeet Sep 21 '15 at 14:17
  • Okay. Just to let you know, machine is 64bit. – Chaitanya Gadkari Sep 21 '15 at 14:20
8

As of 2013 msbuild ships with Visual Studio:

  • C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
  • C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe

Before that msbuild shipped with the .NET Framework, up to version 4.5.1:

  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465