title: Run npm install only when needed and/or partially
body: <p>We call Gulp from our <code>csproj</code> file as we're using Visual Studio 2013 for this project:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Target Name="AfterBuild"&gt;
    &lt;Exec Command="gulp" /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>However, since we're still crafting this fresh project, we often extend the <code>gulpfile.js</code> to include new packages. The dev will do e.g. <code>npm install gulp-util --save-dev</code> and write a new task, and all is well.</p>
  
  <p>The developer then checks the <code>gulpfile.js</code> and <code>packages.json</code> in to our VCS. Currently:</p>
  
  <ul>
  <li>Teamcity has an extra build step <code>npm install</code>;</li>
  <li>Every developer has to run <code>npm install</code> manually;</li>
  </ul>
  
  <p>Having to <em>remember</em> something that has to be done <em>manually</em> is not a great spot to be in. At one point we had this in our <code>csproj</code> file inside the <code>Task</code>...</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;Exec command="npm install" /&gt;
  </code></pre>
  
  <p>...just before the <code>gulp</code> exec, so developers could not "forget" to take this manual step. However, this can take one or even multiple seconds on each (re)build, which is annoying.</p>
  
  <p>Is there any better way to solve this? How do you handle updates to <code>packages.json</code> in projects where large(ish) teams develop using Visual Studio?</p>