I have chosen to develop with ASP.NET Core MVC and I am using the Angular template for the front end (See image below). I want to use this with the Angular Cli to generate components, directives etc. How can I modify the basic template to make it compatible with the Angular Cli?
1 Answers
To integrate Angular Cli with VS 2017 Angular ASP.NET template.... (I will place the path that you should be executing these commands on inside brackets at the end of each step. your_project/ denoting your VS17 project!)
Globally install the Angular Cli
npm install -g @angular/cli@latest(your_project/)Install the Angular Cli in project dev environment
npm install --save-dev @angular/cli@latest(your_project/)Rename app.module.shared.ts file to app.module.ts (your_project/ClientApp/)
Inside the
app.module.browser.tsfile, changeimport { AppModuleShared } from './app.module.shared';toimport { AppModuleShared } from './app.module';(your_project/ClientApp/app/)Inside the
app.module.server.tsfile, changeimport { AppModuleShared } from './app.module.shared';toimport { AppModuleShared } from './app.module';(your_project/ClientApp/app/)Now create a new angular project in a folder on your desktop by issuing the command
ng new test. Once this has complete, copy the angular-cli.json file to the root of your project folder and rename the root field from 'src' to 'ClientApp'. (C:/Users/your_username/Desktop/)Now test that it works by issuing the command
ng g c components/test(your_project/)
For more detail and image click here. I've posted it also to ensure the link doesn't become broken!
