.NET Core Angular VS2017 Templates (Part 2)

Home / .NET Core Angular VS2017 Templates (Part 2)

After my last foray into finding/creating a decent Angular VS2017 template, I decided to go back to a simpler approach and update the previous template I made for Angular 2.x.


The “aspnetcore-angular2-universal” template is nice. After playing around with it and getting it fully working with Angular 4.x, I put it into git:

https://github.com/long2know/aspnetcore-angular-universal

Yes, I really should have branched it rather than creating an isolated repository. I will fix that later in order to have an upgrade/merge path.

As I indicated in my previous post, this template concerns me in that it has fragility. It’s easy to break, and I’m not experienced with using WebPack or the underlying .NET hooks that the template provides for SEO. Reflecting on this also gave me pause to consider whether I really need/want those features. Generally, I build LOB apps that do not need SEO or other public-facing features.

Previously, I created an angular2 template for VS2015.

It started here: https://long2know.com/2016/07/creating-an-angular2-app-with-vs2015/

I later modified it to demo routing using the default VS2015 template/menus: https://long2know.com/2016/07/angular2-basic-routing/

The latter template is the one I decided to use a basis for creating an Angular4 VS2017 template. Generally speaking, it was a pretty easy move. Most of the gulp functionality didn’t need to be changed. I have put the resulting template here:

https://github.com/long2know/angular-simple-routing

In the ng2 iteration, a few people had pointed out that the build process was slow. I examined the flow and it is faster now. One place that was causing slow build times was that some gulp processes would “hang,” even though they were done. Adding explicit process exiting at the end of the process sped this up considerably. As an example:

gulp.task('default', ['lib', 'copy'], function () {
    gulp.src(paths.scripts).pipe(gulp.dest('wwwroot/scripts')).once('end', function () {
        process.exit();
    });
});

With this new template, or the other template, I now will be able to test build processes as I migrate to Angular4 and Dotnet Core.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.