Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Upgrading AngularJS template

Kiran Challa edited this page Jun 25, 2018 · 1 revision

Copied from the PR: https://github.com/aspnet/templating/pull/515#issuecomment-388239235

For our own future reference, here are the steps we went through when upgrading this template. The same steps should be applicable to future Angular version upgrades.

Upgrade steps

  • Run build on templating repo to generate the .csproj files
  • cd to content\Angular-CSharp
  • dotnet build
  • set ASPNETCORE_Environment to Development
  • dotnet run

Install latest Angular CLI

  • npm install -g @angular/cli
  • rm -rf ClientApp
  • ng new ClientApp

Compare the old and new versions in your chosen Git tool Re-apply all the ASP.NET Core-specific modifications from the previous version to the new version

  • Project name should be "Company.WebApplication1", not "ClientApp" - everywhere
  • In angular.json
    • remove "favicon.ico" everywhere
    • Add "node_modules/bootstrap/dist/css/bootstrap.min.css" to the array of styles
    • Add "progress": true under architect/build/options
    • Add "extractCss": true under architect/build/options
    • Set outputpath back just to "dist"
  • In .gitignore
    • Keep the exclusion for /dist-server
  • In README.md
    • Replace "ClientApp" with "Company.WebApplication1"
  • Preserve our content in app.e2e-spec.ts and app.po.ts
  • In package.json
    • Replace "client-app" with "Company.WebApplication1"
    • Add aspnet-prerendering and bootstrap packages like before
  • Restore our versions of the content files
    • src/app/app.component.css
    • src/app/app.component.ts
    • src/app/app.component.spec.ts
    • delete src/app/app.component.spec.ts
    • app.module.ts
    • bring back all the counter, home, fetch-data, nav-meny files
    • delete their favicon.ico
    • index.html
    • main.ts (e.g., BASE_URL providers)

Try it out

  • cd ClientApp
  • npm install
  • cd ..
  • dotnet run

Check out tests

  • cd ClientApp
  • ng lint
  • ng test
  • ng e2e Should all pass without warnings or errors

Try publishing

  • cd back to the main project root directory (AngularSpa)
  • dotnet publish -c Release
  • cd to the publish output folder
  • set ASPNETCORE_Environment to Production
  • dotnet Company.WebApplication1.dll
Clone this wiki locally