title: How to use msbuild inside BeforeBuild Exec?
body: <p>I have a Wix Installer project that needs to run <code>msbuild</code> in order to generate the .dll files and the executable, I currently have it inside my project like so:</p>
  
  <pre><code>&lt;Target Name="BeforeBuild"&gt;
      &lt;!-- Publish dotnet core app --&gt;
      &lt;Exec Command="msbuild /p:configuration=release ..\Regulator2App.WPF\Regulator2App.WPF.csproj" /&gt;
      ...
  &lt;/Target&gt;
  </code></pre>
  
  <p>When I build the Installer project I get the following error:</p>
  
  <pre><code>The attribute "Version" in element &lt;PackageReference&gt; is unrecognized.  Regulator2App.Installer C:\Users\Iván\Desktop\regulator2app\Regulator2App\Regulator2App\Regulator2App.csproj
  </code></pre>
  
  <p>Pointing to this line:</p>
  
  <pre><code>&lt;ItemGroup&gt;
     &lt;PackageReference Include="GuerrillaNtp" Version="1.4.1" /&gt;
     ...
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>And then the command exits with code 1.</p>
  
  <p>How can I add the msbuild command to my installer? What needs to be added/changed?</p>
  
  <p>I have the exact same setup as <a href="https://www.youtube.com/watch?v=6Yf-eDsRrnM" rel="nofollow noreferrer">this tutorial.</a></p>