AspNet Zero depends on angular-cli for development & deployment. It uses angular-cli commands to build and publish its Angular client application. AspNet Zero also minifies and bundles some assets (JS and CSS files) using gulp before publishing the Angular client application since those assets are loaded dynamically at runtime. In order to publish the Angular client application below commands must be run respectively.
yarncommand in the root directory of Angular project.
npm run publishcommand in the root directory of Angular project.
AspNet Zero also provides a merged solution for ASP.NET Core & Angular version. In that solution, Angular client side application is included in the server side Host project. Those two applications, server side API project and Angular client side application, can be published at once and can be hosted together under the same website.
To publish merged Angular solution, follow the steps below;
dotnet publish -c Releasecommand in the root directory of *.Host project. You can add parameters to dotnet publish command, see its documentation.
- When the publish is completed, go to the publish directory and move all files from
Don't forget to configure settings for the Angular application in assets/appconfig.production.json after publishing your app. If you are using the merged Angular project, also configure settings in appsettings.Production.json file.
Angular CLI uses AOT (Ahead of Time) compilation by default. You can add --no-aot parameter
ng build command to disable it. But we recommend AOT feature since it has significant performance gain.