Skip to content

itemwiz options

Andrey Fomin edited this page Oct 14, 2017 · 1 revision

Options

  • Install only the Readme file describing how to manually add an Angular CLI application to the project.
  • Add an Angular CLI application to the project automatically.

Explanation

If you choose the Install only the Readme file option, only the Readme_AngularCLI.txt file will be added to the project's root folder and a NuGet package AfominDotCom.AspNetCore.AngularCLI will be added to the project dependencies.


If you select the Add automatically option in the dialog, the item template will do the following:

  • Run ng new {projectName} --directory . --routing --skip-git --skip-install in the project's root directory.

  • Add a "baseHref" property to the "apps[0]" object in the .angular-cli.json file and assign either "/" in an Empty or WebAPI project or "/ng/" in an MVC or Razor Pages project to it.

  • If an existing package.json is found, merge the package.json file generated by Angular CLI with it. The actual installation of the npm packages does not happen at the time of the application creation, it will happens on next Build of the project.

  • If an existing .gitignore file is found, append Angular CLI entries to it.

  • Add NuGet package AfominDotCom.AspNetCore.AngularCLI to the project.

  • Modify the existing Startup.cs file.

    Add statement using AfominDotCom.AspNetCore.AngularCLI; at the beginning of the file.

    Modify the Configure method. Insert the following code snippet at the end of the method in an WebAPI, MVC or Razor Pages project or before app.Run(...) in an Empty project. If no existing app.UseStaticFiles() call was found in the Configure method, uncomment the app.UseStaticFiles(); line in the code snippet.

if (env.IsDevelopment())
{
  app.UseNgProxy();
}
else
{
  // app.UseStaticFiles(); // Uncomment this line if it is not present somewhere else in the Configure method.
  app.UseNgRoute();
}
Clone this wiki locally