5

I'm writing a script in python to build a solution file and report the number of errors and warnings automatically, for all configuration and platforms. Currently, I rely on the fact that the user provide the location of the msbuild which I can use to build the project. Is there an automated way of finding the location of the latest msbuild.exe in the machine the script is run?

Note that the test machines keep changing and the location of the latest msbuild.exe might be (mostly it's not) different on each. Also, the PATH variable is usually not set for msbuild.exe in the test machines.

deebee
  • 1,747
  • 13
  • 14
  • 3
    This seems to be the same question; http://stackoverflow.com/questions/328017/path-to-msbuild – dutt Apr 26 '12 at 20:15
  • I did see that before asking my question. I was thinking accessing registry keys to get msbuild path is not the optimal way. Just found out I can access registry with the python package -http://docs.python.org/library/_winreg.html. I'll see what I can do. Thanks. – deebee Apr 26 '12 at 21:17

2 Answers2

-2

Have you considered something like...

%FrameworkDir%%FrameworkVersion%\MSBuild.exe
Brian Kretzler
  • 9,748
  • 1
  • 31
  • 28
  • These variables are not set automatically. I was hoping to be able to get them programmatically in python – deebee Apr 27 '12 at 22:48
-2

There is a reserved property for that - $(MSBuildBinPath).

See http://msdn.microsoft.com/en-us/library/ms164309.aspx.

Fabio
  • 730
  • 3
  • 10
  • I'm not entirely sure how to access that property in python. It looks to me that the property is to be used in an msbuild script to identify other files in the same directory as msbuild.exe. – deebee Apr 27 '12 at 23:48
  • That is a reserved property available inside MSBuild, so it doesn't appear to be relevant in this case. For when it is viable, know that $(MSBuildBinPath) is the old property, use the newer $(MSBuildToolsPath) instead. – Brian Kretzler Apr 28 '12 at 16:42