diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in index d5daa84a8f..5892dd9507 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in @@ -55,7 +55,7 @@ - + %(DistFiles.Identity) diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/.gitignore b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/.gitignore index d261e7c729..405d553817 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/.gitignore +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/.gitignore @@ -28,8 +28,6 @@ Obj/ # Visual Studio 2015 cache/options directory .vs/ -/wwwroot/dist/ -/ClientApp/dist/ # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json index 61d23eb269..6994b2a0e6 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.angular-cli.json @@ -6,7 +6,6 @@ "apps": [ { "root": "src", - "outDir": "../wwwroot/dist", "assets": [ "assets" ], diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json index 1cf9c46a3c..baeac30688 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json @@ -4,8 +4,8 @@ "license": "MIT", "scripts": { "ng": "ng", - "start": "ng serve --deploy-url=/dist/ --extract-css", - "build": "ng build --deploy-url=/dist/ --extract-css", + "start": "ng serve --extract-css", + "build": "ng build --extract-css", "build:ssr": "npm run build -- --app=ssr", "test": "ng test", "lint": "ng lint", diff --git a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 0a3bb8cb4d..5120c98180 100644 --- a/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -19,6 +19,12 @@ namespace AngularSpa public void ConfigureServices(IServiceCollection services) { services.AddMvc(); + + // In production, the Angular files will be served from this directory + services.AddSpaStaticFiles(configuration => + { + configuration.RootPath = "ClientApp/dist"; + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -34,6 +40,7 @@ namespace AngularSpa } app.UseStaticFiles(); + app.UseSpaStaticFiles(); app.UseMvc(routes => { @@ -44,7 +51,6 @@ namespace AngularSpa app.UseSpa(spa => { - spa.Options.DefaultPage = "/dist/index.html"; spa.Options.SourcePath = "ClientApp"; /*