title: How to execute MSBuild from Delphi?
body: <p>I'm working on automating our software's build / deploy process. One major piece of this is executing <code>msbuild</code> to compile multiple Delphi projects. </p>
  
  <p>Following numerous resources <a href="http://docwiki.embarcadero.com/RADStudio/Seattle/en/Building_a_Project_Using_an_MSBuild_Command" rel="nofollow noreferrer">such as this one</a>, I can do it successfully from the RAD Studio Command Line (which is simply calling <code>rsvars.bat</code> to set some environment variables). However, when trying to automate both this batch file and the <code>msbuild</code> command from Delphi, I cannot figure out how to proceed.</p>
  
  <p>The key of the issue is that the batch file and the actual <code>msbuild</code> command are two entirely separate commands - although they need to be run together under the same environment. I found <a href="https://stackoverflow.com/questions/3378896/how-to-run-command-line-from-delphi">this question</a> somewhat related, but I don't see a clear answer for my scenario.</p>
  
  <p>How can I execute <code>msbuild</code> from Delphi while first preparing it with the environment variables as found in <code>rsvars.bat</code>?</p>