Search code examples
.net.net-coremsdeploy

Deploy dotnet core application


I'd like to know if it is possible to execute bower install or npm install on remote server after MsDeploy.

I tried to add to my csproj the following lines :

<Target Name="Dependencies install" AfterTargets="AfterPublish">
  <exec command="npm install" />
</Target>

But the command is executed on my local project, not on the remote server where i deployed my project.

Thanks in advance.


Solution

  • Do not run npm install after deploying your project. This will install everything, including any dev dependencies and a lot of stuff not needed for running your web app like sources for your packages right there on the server.

    Normally, you should have your (local) build run npm install and have a bundler like webpack in place to put everything you need in the wwwroot folder. You then deploy that wwwroot folder, which contains anything you need to run your application. And nothing more.