Deploying an Angular 2 application from Visual Studio 2017

前端 未结 5 1221
走了就别回头了
走了就别回头了 2021-02-03 13:04

I use Visual Studio 2017 and have developed two Angular 2 applications. The first is pure Angular 2 with no backend code (Data comes from wcf services). The second is an Angul

5条回答
  •  爱一瞬间的悲伤
    2021-02-03 13:40

    One option is to scaffold the application using the Angular CLI and an ASP.NET Core project.

    1. npm install --global @angular/cli

    2. ng new my-app

    3. Change the outDir in the .angular-cli.json file to point to your project's /wwwroot directory

    4. Configure your application as a static file server.

      void ConfigureServices(...) {
         app.AddMvc(); // Microsoft.AspNetCore.Mvc
      }
      
      void Configure(app) {
         app.UseMvcWithDefaultRoute();
         app.UseDefaultFiles(); // Microsoft.AspNetCore.StaticFiles
         app.UseStaticFiles();
      }
      
    5. Right-click on the project and select Publish Select either Azure App Service or IIS/FTP and follow the on-screen instructions

    Here's a tutorial: https://medium.com/@levifuller/building-an-angular-application-with-asp-net-core-in-visual-studio-2017-visualized-f4b163830eaa

提交回复
热议问题