The .NET Core Framework is non-Microsoft, open-sourced, version of .NET which can run on non-Windows machines. Various versions of .NET Core Framework are 100% compatible with the .NET Standard. That is to say, the .NET Core Framework 2.0 platform is compliant with, "exposes all APIs defined in" or "targets" the .NET Standard 2.0 depending on how you want to think about it. At times, however, the .NET Core Framework version can be ahead of or a superset of the .NET Standard.
The .NET Core Framework 2.0 (otherwise known as the .NET Core SDK 2.0) represents really 3 major parts
- CoreCLR - the .NET runtime
- CoreFX - the .NET framework library
- dotnet.exe - the command-line tool referred to as the "application host CLI" (the part I think should be included when .NET Core Framework is represented)
dotnet new --install Microsoft.AspNetCore.SpaTemplates::*Which command-line (CLI) you ask? Well, here are some other pieces you'll need:
- "Open Command Line" by Mads Kristensen installed through VS2017C IDE/Tools/"Extensions and Updates"
- Git Bash, for you UNIX command-line fans. Git, if not already install by VSI (after VS2017C installation/update step, check first if already installed with "git --version" on the command-line). If Git is not installed, download and install Git Bash that comes with Git from git-scm.com
- NodeJS, if not already install by VSI (after VS2017C installation/update step, check first if already installed with "node -v" on the command-line) installed through download from nodejs.org. This installs "npm.exe" which is crucial.
- NuGet - Project view: Solution Explorer/twirl open project, twirl open Dependencies/twirl open NuGet - To manage, VS2017C/Tools/NuGet Package Manager/Package Manager Console
- npm - Project view: Solution Explorer/twirl open project, twirl open Dependencies/twirl open npm - To manage, the obvious way, open the CLI and go to project's CLI root, edit package.json and execute npm commands.
- .NET Core 2.0/dotnet.exe - Project view: Solution Explorer/twirl open project, twirl open Dependencies/twirl open SDK - To manage, the obvious way, open the CLI and go to project's CLI root, execute dotnet.exe commands, start with "dotnet -h".
Create a New SPA Project (and Solution) Using a .NET Core Project Template
Open VS2017C, File/New/Project/Visual C#/.NET Core/select "ASP.NET Core Web Application", select/create project folder, name project and click OK. At this point, "New ASP.NET Core Web Application" dialog box pops up where you can select one of the following three project templates: Angular, React.js or React.js and Redux.
dotnet new [vue | knockout | aurelia]
Blast Off with "Hello World"Open VS2017C, File/Open/"Project/Solution..."/, browse to project folder, select either the project *.csproj file or solution *.sln file and click Open.
Let the IDE pull in what it thinks it needs, find the play button (green triangle), select "IIS Express" (installed by VSI) and click the play button. Edge browser should launch and display JS SPA reactive webapp per the selected project template.
Data provision: The project template doesn't create a Models folder, the M of the MVC design pattern, probably because not every MVC webapp needs a database therefore no model is needed nor is every MVC application complex enough to warrant the separation of concerns of strongly typed models from a controller or controller method. When strongly typed models are warranted, plain-old class objects backing, or POCOs, source are usually directly located under the Models folder where any controller or the Razor renderer can find them. The POCOs, with C# properties that somewhat match the attributes or columns of a DB table, mirror or model a DB table.
Deleting, Repairing and Restoring IDE and Project Dependencies
- For VS2017C dependencies, close all VS2017C solutions and instances, fire off VSI and under the active IDE, click "More" and select "Repair." After the repair completes, open the solution, click "Build/Clean Solution". VSI can be fired off from VS2017C, from the Tools menu item, click "Get Tools and Features...".
- For updating or updating and reinstalling a solution's NuGet dependencies, Microsoft once again provides many confusing ways to do the same thing. I think the simplest method is open the solution in the VS2017 IDE then goto Tools/Nuget Package Manager/Package Manager Console. In the Package Manager Console, to update only, type "Update-Package." To update and reinstall all dependency packages, type "Update-Package -reinstall". BTW, VS2017 IDE won't tell you when some of solution's NuGet dependency packages have updates. To check for NuGet dependency package updates, open the solution in the VS2017 IDE then goto Tools/Nuget Package Manager/"Manage NuGet Packages for Solution..." and click the "Updates" tab for listed available updates.
- For .NET Core SDK dependencies, from the root folder of project and from the CLI, type "dotnet restore"
- For npm dependencies, delete the node_modules folder in the root of the project folder and from the CLI, type "npm install"
- To do a clean VS2017C build and run, open the solution, click "Build/Rebuild Solution" followed by selecting "IIS Express" (to the right of the play button, the green triangle) and then clicking the play button.