I use Visual Studio 2017 and have developed two Angular 2 applications. The first is pure Angular 2 with no backend code (Data comes from wcf services). The second is an Angul
In addition to the accepted solution, I'd like to add a suggestion for anyone who is using IIS Web deploy (or any of the other methods in the VS publishing tool) and has more than one environment to deploy to: It's pretty neat to use the VS solution configurations.
Edit the .csproj file and change the "Exec Command", adding "$(ConfigurationName)" to the script name:
%(DistFiles.Identity)
PreserveNewest
Edit your package.json to contain a script called buildYourSolutionConfigName:
{
"scripts": {
"buildYourSolutionConfigName": "ng build --someFlagNeeded",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
...
}
...
}
Now you have everything you need to get the app built according to the requirements of the target environment. This allows you to simply select the correct config in VS and push publish.