Thought to share new .Net Core 2.1 version features. Its announced now. And it has got some cool features. First of all to update the existing one, you need to have updated Visual Studio 2017 with 15.7 Preview 1 or newer. Once those updates, in place then you can install the utility directly from this page https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-preview1.
Here is the bullet points of the release taken from http://bit.ly/asp-netcore.
- SignalR – Add real-time web capabilities to your ASP.NET Core apps.
- Razor class libraries – Use Razor to build views and pages into reusable class libraries.
- Identity UI library & scaffolding – Add identity to any app and customize it to meet your needs.
- HTTPS – Enabled by default and easy to configure in production.
- Template additions to help meet some GDPR requirements – Give users control over their personal data and handle cookie consent.
- MVC functional test infrastructure – Write functional tests for your app in-memory.
- [ApiController], ActionResult<T> – Build clean and descriptive web APIs.
- IHttpClientFactory – HttpClient client as a service that you can centrally manage and configure.
- Kestrel on Sockets – Managed sockets replace libuv as Kestrel’s default transport.
- Generic host builder – Generic host infrastructure decoupled from HTTP with support for DI, configuration, and logging.
- Updated SPA templates – Angular, React, and React + Redux templates have been updated to use the standard project structures and build systems for each framework (Angular CLI and create-react-app).
Let’s talk about SPA templates. I have been talking about natural workflow while building any angular app with .net core like using CLI in natural way. Earlier, it used to be little different with scaffolded templates. There we used to tweaks in the module file and shared file to enable CLI. But, with the new template, its now on the same normal course. Below, I have created a sample .net core app using angular.
Therefore, If I see folder structure, overall folder structure looks like as shown below.
However, detailed folder structure for angular template looks like this.
As I said, this is one the most crucial change. Now, this structure is aligned with Angular CLI and this is the change, I have been asking since couple of months from Microsoft team. In earlier versions, one need to tweak ins shared module file to make the same CLI compatible. However, this is natural flow. However, I usually prefer to decouple both client and server side apps. Means I usually scaffold angular app from CLI and then WEB API app as a different standalone app. Nevertheless, whatever way you like, but its fine now.
Couple of things to notice, this template has not embraced latest angular changes, which means angular 6 is not part of this template. You need to manually upgrade the same.
Now, if I just run the same, it will come like
Template-wise, no change. Still the same template. But that’s ok. Now, let’s use the goodness of CLI and add one sample component to it.
Here also you can see the warning that my global version is angular 6, however local version is angular 5. Let’s confirm the same from package.json file.
Here you can see that angular version is still 5. Since, I have added new component, this means that app.module.ts file should have been automatically updated. Here is the code for the same.
I have also added link in navigation file to show the same. With modified changes, now it looks like
I hope you would have liked this discussion. In the coming section, will delve further into the details of the same.
324 total views, 8 views today
Also published on Medium.