How can I programatically get the path to MSBuild from a machine where my .exe is running?
I can get the .NET version from the Environment but is there a way of getting the correct folder for a .NET version?
Poking around the registry, it looks like
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
may be what you're after; fire up regedit.exe and have a look.
reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath
dir HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\