python - Running MSBuild from command prompt -
if open command prompt, , type msbuild, or /msbuild followed path file, says that
'msbuild' not recognized internal or external command, operable program or batch file.'
however, when run same lines in visual studios command prompt works.. know why is?
here python script run msbuild through command prompt
import subprocess filename="c:\users\bb\documents\bb\code\visualstudio\tree.proeapi.unittests\tree.proeapi.unittests.vbproj" p = subprocess.popen(['c:\windows\microsoft.net\framework64\v4.0.30319\msbuild.exe', filename], shell=true, stdout=subprocess.pipe, stderr=subprocess.stdout) line in p.stdout.readlines(): print line, retval = p.wait()
when launch visual studio command prompt, adds additional locations 'path' environment variable - happens include location of msbuild.
interesting side note - can use 'where' command in batch find path of application. example, running 'where msbuild' in visual studio command line outputs this:
c:\program files (x86)\microsoft visual studio 11.0\vc>where msbuild c:\windows\microsoft.net\framework64\v4.0.30319\msbuild.exe c:\windows\microsoft.net\framework64\v3.5\msbuild.exe but in standard command prompt, outputs this:
c:\users\stephen.edmonds>where msbuild info: not find files given pattern(s). you can view current value of path environment variable using command 'set path'
Comments
Post a Comment