Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
142 lines (120 sloc) 6.06 KB

Build status Join the chat at MIT license



  1. .Net core sdk
  2. Either VSCode with C# extension OR Visual studio 2017
  3. Nodejs

**Make sure you have Node version >= latest LTS and NPM >= latest LTS


1. Clone the repo:
    git clone
2. Change directory:
    cd AspNetCoreSpa
3. Restore packages:
    dotnet restore AspNetCoreSpa.sln
4. Run client project
    cd AspNetCoreSpa.Web/ClientApp:
    npm start
5. Run .Net project:
    F5 from either [VScode] ( or [Visual Studio IDE](

6. Point to Sqllite or SqlServer
This project supports both sql server and sql lite databases

* Run with Sqlite:
    * Project is configured to run with sqlite by default and there is an 'Initial' migration already added (see Migrations folder)
    * After changing you models, you can add additional migrations 
    [see docs](

* Run with SqlServer:
    * To run under sql server:
        * npm run clean
        * Delete `Migrations` folder
        * Flip the switch in appsettings.json called `useSqLite` to `false`, this should point to use local sql server setup as default instance. (See appsettings.json file for connection string)
        * Run `dotnet ef migrations add "InitialMigrationName"`

7. Point to identity server:
    For ease project is using hosted idenitty serve at url ( Alternatively, you can run local version of identity server by running AspNetCoreSpa.STS project and change appsettings.Development.json or appsettings.json file's StsAuthority config to identity server's url for appropriate environment.

Other commands

Scaffold Angular components using Angular CLI

Scaffold Usage
Component ng g component my-new-component
Directive ng g directive my-new-directive
Pipe ng g pipe my-new-pipe
Service ng g service my-new-service
Class ng g class my-new-class
Guard ng g guard my-new-guard
Interface ng g interface my-new-interface
Enum ng g enum my-new-enum
Module ng g module my-module

run Angular tests

cd src/AspNetCoreSpa.Web/ClientApp

npm test

Compodoc Angular documentation

  • Steps to generate:
    • npm i compodoc -g
    • cd src/AspNetCoreSpa.Web/ClientApp
    • npm run compodoc
    • cd documentation
    • http-server

Compodoc documentation: alt text

### run end-to-end tests
# make sure you have your server running in another terminal (i.e run "dotnet run" command)
npm run e2e

run Protractor's elementExplorer (for end-to-end)

npm run webdriver:start
# in another terminal
npm run e2e:live

Azure Deploy

  • You can set an environment variable for azure app deployment password Set-Item -path env:AzureAppPass -value passwordhere
From powershell:

Deploy to heroku using its container service

Replace your app name where it is aspnetcorespa

  • dotnet publish -c release
  • docker build -t aspnetcorespa ./bin/release/netcoreapp2.2/publish
  • heroku login
  • heroku container:login
  • docker tag aspnetcorespa
  • docker push Note: There is a deploy.heroku.ps1 script included with this project which automates above steps.

Deploy to Azure as App Service

Set-Item -path env:AzureAppPass -value passwordhere

From powershell: