Créer un nouveau projet ASP.NET core + Angular

dotnet

Doc Microsoft

https://docs.microsoft.com/en-us/aspnet/core/spa/angular?view=aspnetcore-2.1&tabs=visual-studio

There are slight differences between the Angular app created by this template and the one created by Angular CLI itself (via ng new). The project is configured to start its own instance of the Angular CLI server in the background when the ASP.NET Core app starts in development mode.

Installer les derniers templates Angular

dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0

Créer un nouveau projet

dotnet new angular -o my-new-app
cd my-new-app

Cela génère un fichier .angular-cli.json, angular.json est utilisé avec angular-cli 6.0.0.

Vérifier le build

  • Avec Visual Studio : Ouvre le fichier .csproj généré, et compilé en mode Debug le projet.

  • Avec .NET Core CLI : SET ASPNETCORE_Environment=Development dotnet build dotnet run

Résultat structure du projet

ClientApp
├── README.md
├── e2e
│   ├── app.e2e-spec.ts
│   ├── app.po.ts
│   └── tsconfig.e2e.json
├── karma.conf.js
├── package.json
├── protractor.conf.js
├── src
│   ├── app
│   │   ├── app.component.css
│   │   ├── app.component.html
│   │   ├── app.component.spec.ts
│   │   ├── app.component.ts
│   │   └── app.module.ts
│   ├── assets
│   ├── environments
│   │   ├── environment.prod.ts
│   │   └── environment.ts
│   ├── favicon.ico
│   ├── index.html
│   ├── main.ts
│   ├── polyfills.ts
│   ├── styles.css
│   ├── test.ts
│   ├── tsconfig.app.json
│   ├── tsconfig.spec.json
│   └── typings.d.ts
├── tsconfig.json
└── tslint.json

https://www.c-sharpcorner.com/article/angular-5-cli-project-and-asp-net-core-project-combining/

Visual Studio + angular-cli

Séparation Frontend / Backend

https://devblog.dymel.pl/2016/10/25/angular2-cli-with-aspnet-core-application-tutorial/

https://dustinewers.com/angular-cli-with-net-core/

angular-cli

ng new sassy-project --style=stylus