How to find MSBuild Path

Viewed 33

I have a post-build event command line to build a project again:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" "$(ProjectDir)ProfileTypes.csproj" /p:Configuration="DebugFinal"

This is working fine, however on someone else's pc, MSBuild.exe could be in a different directory, how can I get the directory of the MSBuild.exe without hard-coding it?

1 Answers

You can get the path to the MSBuild.exe that runs the project by using $(MSBuildBinPath)\msbuild.exe.

Related