title: How to use MSBuild to build a Visual Studio Setup Project
body: <p>I am trying to use MSBuild to build a Visual Studio Setup Project using the article below:</p>
  <p><s>http://msdn.microsoft.com/en-us/library/ms404859.aspx</s>
  <a href="https://web.archive.org/web/20090218033835/msdn.microsoft.com/en-us/library/ms404859.aspx" rel="nofollow noreferrer">https://web.archive.org/web/20090218033835/msdn.microsoft.com/en-us/library/ms404859.aspx</a></p>
  <p>I have followed all the steps mentioned in the article above with the exception of not using TFS in this case.</p>
  <p>Instead of using the TFS option, I am trying to create a Demo.proj file and have included the below details:
  ** - Demo.proj**</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;Project xmlns=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;&gt;
    &lt;Target Name=&quot;AfterCompile&quot;&gt;
      &lt;Exec Command=&quot;&amp;quot;$(ProgramFiles)\Microsoft Visual Studio 9.0\Common7\IDE\devenv&amp;quot; &amp;quot;C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\HelloWorldTestInstaller.vdproj&amp;quot; /Build &amp;quot;Debug|Any CPU&amp;quot;&quot;/&gt;
      &lt;Copy SourceFiles=&quot;C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\Debug\HelloWorldTestInstaller.msi; C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\Debug\setup.exe&quot; DestinationFolder=&quot;$(OutDir)&quot; /&gt;
    &lt;/Target&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>now when I trying to cmd prompt and trying the following command:</p>
  <p>msbuild DemoBuild.proj /target:AfterCompile</p>
  <p>I am getting the following error:</p>
  <p>Build FAILED.</p>
  <p>&quot;C:\xxxxxxxxx\Documents\Visual Studio 2010\Projects\HelloWorldTest\DemoBuild.proj&quot; (default target) (1) -&gt;
  (AfterCompile target) -&gt;
  C:\xxxxxxxxx\Visual Studio 2010\Projects\HelloWorldTest\DemoBuild.proj(4,5): error MSB3073: The command &quot;&quot;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv&quot; &quot;C:\xxxxxxxxx\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\HelloWorldTestInstaller.vdproj&quot; /Build &quot;Debug|Any CPU&quot;&quot; exited with code 1.</p>
  <pre><code>0 Warning(s)
  1 Error(s)
  </code></pre>
  <p>Time Elapsed 00:00:01.25</p>
  <p>Can anyone help me to resolve this issue.</p>
  <p>Thanks &amp; Regards,
  Santosh Kumar Patro</p>