1

I have an Angular 4 on .NET Core MVC project hosted on Azure. After each publish I would like to run NPM INSTALL to update all my dependencies. Currently, I am opening Kudu and running it manually. Not a big deal, but I was wondering if there a way to automate this.

Thank you.

EDIT: The link posted below does clear part of my question, but I am still not sure how to create the .cmd file mentioned there.

dpdragnev
  • 2,011
  • 2
  • 28
  • 55
  • Possible duplicate of [How to add a custom post deployment script to azure websites?](https://stackoverflow.com/questions/26350201/how-to-add-a-custom-post-deployment-script-to-azure-websites) – joncloud Aug 19 '17 at 23:25
  • Thank you for the link @joncloud. Although, there was no need to down vote my question. Do you think, I would have wasted mine and everyone else's time to write a question if I have come across this link during my search. – dpdragnev Aug 20 '17 at 00:41

1 Answers1

4

Here is a more detailed explanation on how to achieve this:

  1. Open Kudu by visiting https://your-app-name.scm.azurewebsites.net/
  2. In the debug console, navigate to site\deployments\tools
  3. If it does not exist, create a folder called PostDeploymentActions
  4. In it create a file post-deploy.cmd (you can name it whatever you want)
  5. In this file enter the following:

cd "D:\home\site\wwwroot\wwwroot"
call npm install

This assumes that package.json and node_modules are in your wwwroot directory. If not enter the correct path.

After the deploy your cmd file will get executed. To confirm, navigate to home\LogFiles\SiteExtensions\MSDeploy and view appManager.xml. You should be able to see your cmd file executed there.

Hope this saves someone some research time.

dpdragnev
  • 2,011
  • 2
  • 28
  • 55