From 0c4198948f930fde341bceaab59f6ee1f40f3f61 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:05:34 +0000 Subject: [PATCH 1/5] chore: upgrade EqDemo.AspNetCoreVue2.AdvancedSearch to .NET 8.0 - Update TargetFramework from net6.0 to net8.0 - Update Microsoft.EntityFrameworkCore.Sqlite 6.0.1 -> 8.0.11 - Update Microsoft.EntityFrameworkCore.SqlServer 6.0.1 -> 8.0.11 - Update Microsoft.Data.SqlClient 2.1.7 -> 5.2.2 - Bump Microsoft.IdentityModel.JsonWebTokens and System.IdentityModel.Tokens.Jwt to 6.35.0 (required by SqlClient 5.2.2) - Remove Microsoft.AspNetCore.SpaServices.Extensions (removed in .NET 8) - Remove VueCliMiddleware (incompatible with .NET 8) - Add Microsoft.AspNetCore.SpaProxy 8.0.11 with SPA proxy configuration - Update Startup.cs to replace old SPA middleware with UseDefaultFiles, UseStaticFiles, and MapFallbackToFile Co-Authored-By: Toby Drinkall --- ...qDemo.AspNetCoreVue2.AdvancedSearch.csproj | 19 +++++++------ AspNetCore/Vue2/AdvancedSearch/Startup.cs | 28 ++----------------- 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj b/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj index b84cd155..7c792a09 100644 --- a/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj +++ b/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj @@ -1,25 +1,26 @@ - net6.0 + net8.0 3.0 ClientApp\ $(DefaultItemExcludes);$(SpaRoot)node_modules\** EqDemo.AspNetCoreVue.AdvancedSearch true + npm run serve + http://localhost:8085 - - - + + + - + - - - + + @@ -65,4 +66,4 @@ - \ No newline at end of file + diff --git a/AspNetCore/Vue2/AdvancedSearch/Startup.cs b/AspNetCore/Vue2/AdvancedSearch/Startup.cs index e1fcb214..4e9ecaf3 100644 --- a/AspNetCore/Vue2/AdvancedSearch/Startup.cs +++ b/AspNetCore/Vue2/AdvancedSearch/Startup.cs @@ -7,8 +7,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.EntityFrameworkCore; -using VueCliMiddleware; - using Korzh.EasyQuery.Services; using EasyData.Export; @@ -44,12 +42,6 @@ public void ConfigureServices(IServiceCollection services) services.AddControllersWithViews(); - // In production, the React files will be served from this directory - services.AddSpaStaticFiles(configuration => - { - configuration.RootPath = "ClientApp/dist"; - }); - services.AddEasyQuery() .UseSqlManager() .AddDefaultExporters() @@ -77,10 +69,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseCors("AllowAllPolicy"); app.UseHttpsRedirection(); + app.UseDefaultFiles(); app.UseStaticFiles(); - if (!env.IsDevelopment()) { - app.UseSpaStaticFiles(); - } app.UseRouting(); @@ -103,24 +93,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); - }); - app.UseSpa(spa => - { - spa.Options.SourcePath = "ClientApp"; - spa.Options.StartupTimeout = TimeSpan.FromMinutes(2); - - if (env.IsDevelopment()) - { - // run npm process with client app - spa.UseVueCli(npmScript: "serve", port: 8085, regex: "Compiled "); - // if you just prefer to proxy requests from client app, use proxy to SPA dev server instead: - // app should be already running before starting a .NET client - // spa.UseProxyToSpaDevelopmentServer("http://localhost:8080"); // your Vue app port - } + endpoints.MapFallbackToFile("index.html"); }); - //Init demo database (if necessary) app.EnsureDbInitialized(Configuration, env); } From ef1c3e387309905eaa3e18303c26b542ea8098e7 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:09:50 +0000 Subject: [PATCH 2/5] fix: add ASPNETCORE_HOSTINGSTARTUPASSEMBLIES for SpaProxy activation Add the required environment variable to both IIS Express and EqVueDemo profiles in launchSettings.json so Microsoft.AspNetCore.SpaProxy's hosting startup assembly is activated during development. Co-Authored-By: Toby Drinkall --- .../Vue2/AdvancedSearch/Properties/launchSettings.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/AspNetCore/Vue2/AdvancedSearch/Properties/launchSettings.json b/AspNetCore/Vue2/AdvancedSearch/Properties/launchSettings.json index c990ef22..39e7bd35 100644 --- a/AspNetCore/Vue2/AdvancedSearch/Properties/launchSettings.json +++ b/AspNetCore/Vue2/AdvancedSearch/Properties/launchSettings.json @@ -12,16 +12,18 @@ "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" } }, "EqVueDemo": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" }, "applicationUrl": "https://localhost:5001;http://localhost:5000" } } -} \ No newline at end of file +} From 666b48849174405565f190efa773910f79737b10 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:15:22 +0000 Subject: [PATCH 3/5] fix: serve SPA static files from ClientApp/dist for production Configure UseStaticFiles, UseDefaultFiles, and MapFallbackToFile with a PhysicalFileProvider pointing to ClientApp/dist so the Vue build output is served correctly in production (wwwroot does not exist in this project). Also fix PublishRunWebpack target to reference ClientApp/dist instead of ClientApp/build (Vue CLI outputs to dist by default). Co-Authored-By: Toby Drinkall --- .../EqDemo.AspNetCoreVue2.AdvancedSearch.csproj | 2 +- AspNetCore/Vue2/AdvancedSearch/Startup.cs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj b/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj index 7c792a09..a37fd929 100644 --- a/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj +++ b/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj @@ -59,7 +59,7 @@ - + %(DistFiles.Identity) PreserveNewest diff --git a/AspNetCore/Vue2/AdvancedSearch/Startup.cs b/AspNetCore/Vue2/AdvancedSearch/Startup.cs index 4e9ecaf3..c23ab614 100644 --- a/AspNetCore/Vue2/AdvancedSearch/Startup.cs +++ b/AspNetCore/Vue2/AdvancedSearch/Startup.cs @@ -1,9 +1,11 @@ using System; +using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; using Microsoft.EntityFrameworkCore; @@ -69,7 +71,15 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseCors("AllowAllPolicy"); app.UseHttpsRedirection(); - app.UseDefaultFiles(); + + // Serve Vue SPA build output from ClientApp/dist in production + var spaPath = Path.Combine(env.ContentRootPath, "ClientApp", "dist"); + if (Directory.Exists(spaPath)) { + var fileProvider = new PhysicalFileProvider(spaPath); + app.UseDefaultFiles(new DefaultFilesOptions { FileProvider = fileProvider }); + app.UseStaticFiles(new StaticFileOptions { FileProvider = fileProvider }); + } + app.UseStaticFiles(); @@ -94,7 +104,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) name: "default", pattern: "{controller}/{action=Index}/{id?}"); - endpoints.MapFallbackToFile("index.html"); + endpoints.MapFallbackToFile("index.html", new StaticFileOptions { + FileProvider = new PhysicalFileProvider( + Path.Combine(env.ContentRootPath, "ClientApp", "dist")) + }); }); //Init demo database (if necessary) From 12b9c5e0d556ffc58923f1875bdd8dd509f504d9 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:17:54 +0000 Subject: [PATCH 4/5] fix: guard MapFallbackToFile with Directory.Exists check Wrap the MapFallbackToFile registration in a Directory.Exists guard to prevent PhysicalFileProvider from throwing DirectoryNotFoundException when ClientApp/dist doesn't exist in development mode. Co-Authored-By: Toby Drinkall --- AspNetCore/Vue2/AdvancedSearch/Startup.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/AspNetCore/Vue2/AdvancedSearch/Startup.cs b/AspNetCore/Vue2/AdvancedSearch/Startup.cs index c23ab614..ab502da3 100644 --- a/AspNetCore/Vue2/AdvancedSearch/Startup.cs +++ b/AspNetCore/Vue2/AdvancedSearch/Startup.cs @@ -104,10 +104,12 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) name: "default", pattern: "{controller}/{action=Index}/{id?}"); - endpoints.MapFallbackToFile("index.html", new StaticFileOptions { - FileProvider = new PhysicalFileProvider( - Path.Combine(env.ContentRootPath, "ClientApp", "dist")) - }); + if (Directory.Exists(Path.Combine(env.ContentRootPath, "ClientApp", "dist"))) { + endpoints.MapFallbackToFile("index.html", new StaticFileOptions { + FileProvider = new PhysicalFileProvider( + Path.Combine(env.ContentRootPath, "ClientApp", "dist")) + }); + } }); //Init demo database (if necessary) From 74927589bfbfab2b968927c0a0567108bf5a9cf1 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:21:37 +0000 Subject: [PATCH 5/5] fix: pass --port 8085 to Vue CLI dev server in SpaProxyLaunchCommand The old VueCliMiddleware explicitly started the dev server on port 8085. Without the --port flag, npm run serve defaults to 8080, causing a mismatch with SpaProxyServerUrl which expects 8085. Co-Authored-By: Toby Drinkall --- .../AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj b/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj index a37fd929..658e98e5 100644 --- a/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj +++ b/AspNetCore/Vue2/AdvancedSearch/EqDemo.AspNetCoreVue2.AdvancedSearch.csproj @@ -6,7 +6,7 @@ $(DefaultItemExcludes);$(SpaRoot)node_modules\** EqDemo.AspNetCoreVue.AdvancedSearch true - npm run serve + npm run serve -- --port 8085 http://localhost:8085