I have successfully set up an angular-cli based project in Visual Studio 2017 by following the steps outlined in this link:
Within my project's Pre-Build events, I have the following commands:
echo "cd $(SolutionDir)" &&^
cd "$(SolutionDir)" &&^
echo "Building Project" &&^
ng build &&^
echo 'copy files' &&^
When I Build or Rebuild the project in Visual Studio, everything works correctly. The bundle files are generated in the output directory as specified in angular-cli.json.
However, I am looking for a way to watch for changes using ng build
from within Visual Studio. I attempted to add ng build --watch
in the Pre-Build events, but it caused the Build process to hang indefinitely. Although the correct bundle files were being generated in the output directory, the Build process never completed in Visual Studio 2017.
As a temporary solution, I am currently running ng build --watch
in a separate command window, which monitors and rebuilds the project as expected when changes are made to TypeScript, HTML, or CSS files. However, I would prefer to integrate this functionality natively within Visual Studio 2017.
Please note: While I have included "compileOnSave": true
in my tsconfig.json, it does not provide the same capabilities as ng build
. Thank you.