title: continuously deploy Angular2 app to Azure Web App using Release Management and angular-cli
body: <p>I am currently developing an Angular2 app and want to configure continuous integration and continuous deployment with azure release manager.</p>
  
  <p>Things I got working so far: CI and CD to WebApp, home/site/wwwroot contains source files (no node_modules).</p>
  
  <p>Things not working: App doesn't start. Browsing to url leads to the placeholder (e.g. 'Loading...'). On my local machine I would call 'npm install' and then 'npm start' wich in turn calls 'tsc &amp;&amp; concurrently "tsc -w" "lite-server"'. From my understanding this is fine for a dev environment, but should not be used in production.</p>
  
  <p>Things I have tried: </p>
  
  <ol>
  <li>adding 'npm install' to build step leads to extremely long build time bc of the download of the packages and long deployment time bc of the high number of packages</li>
  <li>adding 'npm install --production' shortens the build and deployment time, but running 'npm start' on the target machine fails because some missing packages (contained in DevDependencies)</li>
  <li>executing 'npm install' and 'npm start' on the target machine with console seems to work, but can't be automated</li>
  </ol>
  
  <p>So the question(s) are:</p>
  
  <ol>
  <li>what is the proper way to build and deploy an Angular2 app on an Azure Web App?</li>
  <li>How to handle the node_modules?</li>
  </ol>
  
  <p>Thank you in advance.</p>
  
  <p><strong>UPDATE:</strong> As i switched to angular-cli things are getting clearer now. On my dev machine i use "ng build" and "ng serve" to run locally. For deployment I use "ng build -prod" and deploy the contents of the created "dist" directory to production. Howewer, this is still a workaround as I can't get the build agent to  do these steps. I tried moving the angular-cli reference to "Dependencies" and then call "npm install" and "ng build -prod" on the agent to get the "dist" folder. My Deployment config would then copy the contents of the dist folder to the web app. Then "ng build -prod" step fails </p>
  
  <blockquote>
    <p>'ng' is not recognized as an internal or external command</p>
  </blockquote>
  
  <p>I sort of understand that I can't install and run any package on the build agent, but I would really like to use angular-cli to build the app since it includes webpack. Is there any possibility to get this working as described?</p>