The setup:
- ASP.Net MVC 5 application (v4.5.2).
- Angular (v5.2.0) using angular-cli(v1.7.4) inside the MVC application.
- Angular app runs on www.mydomain.com/app.
- The angular application is loaded in the Index view of the AppController.
- The necessary JS and CSS output files in the dist folder are referenced using BundleConfig.cs.
- The build process has been modified to build the Angular application using the .csproj file.
- ng build is using -extract-css(-ec) so that the Index.cshtml file does not have to change between dev and production.
- Everything works correctly up to this point.
.csproj:
<Target Name="NgDebug" BeforeTargets="Build" Condition="'$(Configuration)' == 'Debug'">
<Exec WorkingDirectory="$(ProjectDir)admin-client" Command="ng build -ec" />
</Target>
<Target Name="NgRelease" BeforeTargets="Build" Condition="'$(Configuration)' == 'Release'">
<Exec WorkingDirectory="$(ProjectDir)admin-client" Command="ng build --prod" />
</Target>
The problem:
- When --watch (-w) is added to the
Command="ng build -ec"the build hangs indefinitely and doesn't throw any errors. - Build output hangs:
1>------ Build started: Project: CorpNet.Admin.Web, Configuration: Debug Any CPU ------
My solution:
After the application starts I run ng build -ec -w via the command line and everything works correctly.
Question:
How do you add the --watch (-w) to ng build -ec as part of the build process instead of running it manually from the command line?