The features described in this article are obsolete as of ASP.NET Core 3.0. A simpler SPA frameworks integration mechanism is available in the Microsoft.AspNetCore.SpaServices.Extensions NuGet package. For more information, see [Announcement] Obsoleting Microsoft.AspNetCore.SpaServices and Microsoft.AspNetCore.NodeServices.
JavaScriptServices is a set of client-side technologies for ASP.NET Core. It provides infrastructure that you'll find useful if you:
Read Building Single Page Applications on ASP.NET Core with JavaScriptServices for more details.
This repo contains:
It's cross-platform (Windows, Linux, or macOS) and works with .NET Core 2.0 or later.
Prerequisites:
With these prerequisites, you can immediately create new ASP.NET Core applications that use Angular, React, or React+Redux without having to install anything extra.
In an empty directory, run (for example) dotnet new angular. Other supported SPA frameworks include React and React+Redux. You can see the list of available SPA templates by running dotnet new spa.
Once the generator has run and restored all the dependencies, you can start up your new ASP.NET Core SPA:
npm install
dotnet run
Using the File->New Project dialog, select ASP.NET Core Web Application. You will then be offered the option to create an application with Angular, React, or React+Redux. When the application is created, you can build and run it in the normal way.
For a more detailed (albeit somewhat outdated) walkthrough, see getting started with the aspnetcore-spa generator.
If you want to build an ASP.NET Core application with Aurelia, Knockout, or Vue, you can use the Microsoft.AspNetCore.SpaTemplates package. On the command line, run dotnet new --install Microsoft.AspNetCore.SpaTemplates. Then you will be able to run dotnet new aurelia (or dotnet new vue, etc.) to create your new application.
If you have an existing ASP.NET Core application, or if you just want to use the underlying JavaScriptServices packages directly, you can install these packages using NuGet and NPM:
Microsoft.AspNetCore.NodeServices
Microsoft.AspNetCore.SpaServices
NodeServices package to implement its features.There were previously other packages called Microsoft.AspNetCore.AngularServices and Microsoft.AspNetCore.ReactServices but these are not currently needed - all applicable functionality is in Microsoft.AspNetCore.SpaServices, because it's sufficiently general.
If you want to build a helper library for some other SPA framework, you can do so by taking a dependency on Microsoft.AspNetCore.SpaServices and wrapping its functionality in whatever way is most useful for your SPA framework.
The samples directory contains examples of:
NodeServices usage for runtime code transpilation and image processing.To run the samples:
src, samples, etc.), run dotnet restorecd samples/angular/MusicStore)npm install
gulp (which you need to have installed globally). None of the other samples require this.dotnet run)906 followers · starred Nov 2016
600 followers · starred Nov 2015
685 followers · starred Jun 2017
1,024 followers · starred Jul 2016
The features described in this article are obsolete as of ASP.NET Core 3.0. A simpler SPA frameworks integration mechanism is available in the Microsoft.AspNetCore.SpaServices.Extensions NuGet package. For more information, see [Announcement] Obsoleting Microsoft.AspNetCore.SpaServices and Microsoft.AspNetCore.NodeServices.
JavaScriptServices is a set of client-side technologies for ASP.NET Core. It provides infrastructure that you'll find useful if you:
Read Building Single Page Applications on ASP.NET Core with JavaScriptServices for more details.
This repo contains:
It's cross-platform (Windows, Linux, or macOS) and works with .NET Core 2.0 or later.
Prerequisites:
With these prerequisites, you can immediately create new ASP.NET Core applications that use Angular, React, or React+Redux without having to install anything extra.
In an empty directory, run (for example) dotnet new angular. Other supported SPA frameworks include React and React+Redux. You can see the list of available SPA templates by running dotnet new spa.
Once the generator has run and restored all the dependencies, you can start up your new ASP.NET Core SPA:
npm install
dotnet run
Using the File->New Project dialog, select ASP.NET Core Web Application. You will then be offered the option to create an application with Angular, React, or React+Redux. When the application is created, you can build and run it in the normal way.
For a more detailed (albeit somewhat outdated) walkthrough, see getting started with the aspnetcore-spa generator.
If you want to build an ASP.NET Core application with Aurelia, Knockout, or Vue, you can use the Microsoft.AspNetCore.SpaTemplates package. On the command line, run dotnet new --install Microsoft.AspNetCore.SpaTemplates. Then you will be able to run dotnet new aurelia (or dotnet new vue, etc.) to create your new application.
If you have an existing ASP.NET Core application, or if you just want to use the underlying JavaScriptServices packages directly, you can install these packages using NuGet and NPM:
Microsoft.AspNetCore.NodeServices
Microsoft.AspNetCore.SpaServices
NodeServices package to implement its features.There were previously other packages called Microsoft.AspNetCore.AngularServices and Microsoft.AspNetCore.ReactServices but these are not currently needed - all applicable functionality is in Microsoft.AspNetCore.SpaServices, because it's sufficiently general.
If you want to build a helper library for some other SPA framework, you can do so by taking a dependency on Microsoft.AspNetCore.SpaServices and wrapping its functionality in whatever way is most useful for your SPA framework.
The samples directory contains examples of:
NodeServices usage for runtime code transpilation and image processing.To run the samples:
src, samples, etc.), run dotnet restorecd samples/angular/MusicStore)npm install
gulp (which you need to have installed globally). None of the other samples require this.dotnet run)906 followers · starred Nov 2016
600 followers · starred Nov 2015
685 followers · starred Jun 2017
1,024 followers · starred Jul 2016