Skip to content

Upgrade Stencil AdvancedSearch sample to .NET 8#36

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1777991025-net8-stencil-advsearch
Open

Upgrade Stencil AdvancedSearch sample to .NET 8#36
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1777991025-net8-stencil-advsearch

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented May 5, 2026

Summary

Upgrades the Stencil AdvancedSearch sample (AspNetCore/Stencil/AdvancedSearch/) from net6.0 to net8.0, refreshes EF Core / Microsoft.Data.SqlClient / Microsoft.IdentityModel.* package versions, drops legacy BCL-shim packages, and replaces the deprecated VueCliMiddleware + Microsoft.AspNetCore.SpaServices.Extensions SPA wiring with Microsoft.AspNetCore.SpaProxy.

This is a scoped change — only the files inside AspNetCore/Stencil/AdvancedSearch/ were touched. No .sln, no root files, no other projects in the repo were modified.

.csproj modified

AspNetCore/Stencil/AdvancedSearch/EqDemo.AspNetCoreStencil.AdvancedSearch.csproj

Before After
TFM net6.0 net8.0
Microsoft.EntityFrameworkCore.Sqlite 6.0.1 8.0.26
Microsoft.EntityFrameworkCore.SqlServer 6.0.1 8.0.26
Microsoft.Data.Sqlite.Core 6.0.1 8.0.26
Microsoft.Data.SqlClient 2.1.7 5.2.3
Microsoft.IdentityModel.JsonWebTokens 6.34.0 7.7.1
System.IdentityModel.Tokens.Jwt 6.34.0 7.7.1
VueCliMiddleware 6.0.0 removed — replaced with Microsoft.AspNetCore.SpaProxy 8.0.26
Microsoft.AspNetCore.SpaServices.Extensions 6.0.1 removed
System.Data.SqlClient 4.8.6 removed (BCL/Microsoft.Data.SqlClient covers this in net8)
System.Net.Http 4.3.4 removed (BCL)
System.Text.RegularExpressions 4.3.1 removed (BCL)
System.Drawing.Common 4.7.2 removed (was unused in this project)

Added MSBuild properties to support the new SpaProxy package:

<SpaProxyServerUrl>http://localhost:4444</SpaProxyServerUrl>
<SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand>

SpaRoot was already present (ClientApp\). The proxy URL/port matches the Stencil dev server configured in ClientApp/stencil.config.ts (devServer.port = 4444), and npm start matches the start script in ClientApp/package.json (stencil build --dev --watch --serve). Untouched packages (Korzh / EasyData / EasyQuery) were left at their existing versions per the "do not bump unrelated dependencies" constraint.

Also fixed the PublishRunWebpack MSBuild target so the production fallback actually has assets to serve:

  • Source globbing changed from $(SpaRoot)build\** (a path Stencil never produces) to $(SpaRoot)www\**, matching ClientApp/stencil.config.ts (outputTargets: [{ type: 'www' }]).
  • <RelativePath> changed from %(DistFiles.Identity) to wwwroot\%(RecursiveDir)%(FileName)%(Extension) so the prebuilt assets land under wwwroot/ in the publish output, where app.UseStaticFiles() can serve them. This mirrors the pattern already in use in AspNetCore/Angular/AdvancedSearch/EqDemo.Angular.AdvancedSearch.csproj.

Code changes

AspNetCore/Stencil/AdvancedSearch/Startup.cs:

  • Removed using System.Data.SqlClient; — the package was removed and the directive was unused in this file (no SqlConnection/SqlCommand references anywhere under AspNetCore/Stencil/AdvancedSearch/).
  • Removed services.AddSpaStaticFiles(...) from ConfigureServicesMicrosoft.AspNetCore.SpaServices.Extensions is gone.
  • Removed app.UseSpaStaticFiles(); from the request pipeline.
  • Removed the app.UseSpa(spa => { ... spa.UseProxyToSpaDevelopmentServer("http://localhost:4444/"); }) block. With Microsoft.AspNetCore.SpaProxy and the new MSBuild properties, the dev-time proxy/launch is wired up automatically by the package's HostingStartup; no explicit middleware call is needed in Startup.cs.
  • Added endpoints.MapFallbackToFile("index.html"); after MapControllerRoute(...) to keep the SPA-style production fallback intact (client-side routes fall back to the prebuilt index.html under wwwroot/). This matches the .NET 8 SpaProxy pattern already in use in the sibling sample at AspNetCore/Angular/AdvancedSearch/Program.cs:84.
  • app.UseStaticFiles(); is retained so prebuilt static assets under wwwroot/ are served in production.

Program.cs was not modified — the existing host-builder bootstrap is fully compatible with .NET 8.

No changes were made to anything under ClientApp/, no other projects were touched, no .sln / global.json / Directory.Build.props were added or edited.

Build verification

Locally on the VM (Ubuntu, .NET SDK 8.0.420, installed via dotnet-install.sh --channel 8.0):

dotnet restore AspNetCore/Stencil/AdvancedSearch/EqDemo.AspNetCoreStencil.AdvancedSearch.csproj
dotnet build   AspNetCore/Stencil/AdvancedSearch/EqDemo.AspNetCoreStencil.AdvancedSearch.csproj -c Release --no-restore

Result: Build succeeded — 0 Warning(s), 0 Error(s).

CI

  • Build / lint: not configured in this repo (no GitHub Actions workflows for AspNetCore/Stencil/AdvancedSearch/).
  • Devin Review: the only blocking finding (missing SPA fallback / wrong publish path) was addressed in commit 6f50af3 and replied to inline.
  • security/snyk and license/snyk: failing on this PR. The same two checks are also failing on every parallel sibling .NET 8 upgrade PR in this repo (e.g. PR chore(net8): upgrade AspNetCore/Vue2/AdvancedSearch to .NET 8 #35), and the failures are flagging packages that are out of scope for this task (the explicit constraint in the parent prompt is "Do NOT bump unrelated dependencies just because newer versions exist. Only touch the packages explicitly listed."). The packages flagged here are pre-existing Korzh.* / EasyData.Exporters.* versions inherited from master. Worth a separate dedicated PR to triage.

Review & Testing Checklist for Human

Risk: yellow (single-project package + SPA-middleware swap; ClientApp/ source untouched; build clean locally).

  • Run the project in Development (dotnet run --project AspNetCore/Stencil/AdvancedSearch/EqDemo.AspNetCoreStencil.AdvancedSearch.csproj) with npm install already done in ClientApp/. Confirm the Stencil dev server is auto-launched on :4444 by Microsoft.AspNetCore.SpaProxy (driven by the new <SpaProxyServerUrl> / <SpaProxyLaunchCommand> MSBuild properties) and the SPA loads end-to-end against the bundled SQLite NWind DB.
  • dotnet publish -c Release from AspNetCore/Stencil/AdvancedSearch/, then run the published output. Confirm the prebuilt Stencil assets (now copied to wwwroot/ by the updated PublishRunWebpack target) are served by app.UseStaticFiles(), and that an unknown SPA route falls back to index.html via MapFallbackToFile.
  • Sanity-check the Snyk findings against the parallel sibling PRs (e.g. PR chore(net8): upgrade AspNetCore/Vue2/AdvancedSearch to .NET 8 #35) to confirm they're flagging pre-existing packages outside this task's scope and not regressions introduced here.

Notes

  • Stencil ClientApp/ source is untouched.
  • No .sln edits were required; the existing solution file resolves the upgraded TFM correctly.
  • Sibling .NET 8 upgrade PRs are being opened by parallel sessions; this PR deliberately stays inside AspNetCore/Stencil/AdvancedSearch/.

Link to Devin session: https://app.devin.ai/sessions/c53cd3fab43e479fa381535eb6c8244e
Requested by: @tobydrinkall


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)
Open in Devin Review

- Bump TFM to net8.0
- Bump EF Core (Sqlite, SqlServer) and Microsoft.Data.Sqlite.Core to 8.0.26
- Replace VueCliMiddleware with Microsoft.AspNetCore.SpaProxy 8.0.26
  + add SpaProxyServerUrl/SpaProxyLaunchCommand MSBuild properties
- Remove Microsoft.AspNetCore.SpaServices.Extensions
- Remove legacy System.Data.SqlClient, System.Net.Http,
  System.Text.RegularExpressions, System.Drawing.Common
- Bump Microsoft.Data.SqlClient to 5.2.3
- Bump Microsoft.IdentityModel.JsonWebTokens and System.IdentityModel.Tokens.Jwt
  to 7.7.1
- Drop AddSpaStaticFiles/UseSpaStaticFiles/UseSpa from Startup.cs
- Drop unused 'using System.Data.SqlClient;'

Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

- Add endpoints.MapFallbackToFile("index.html") so SPA client-side
  routes fall back to index.html in production (matches the .NET 8
  SpaProxy pattern used in the sibling Angular sample at
  AspNetCore/Angular/AdvancedSearch/Program.cs).
- Fix PublishRunWebpack target to copy Stencil's actual build output
  ($(SpaRoot)www\**, per stencil.config.ts outputTargets) into wwwroot
  on publish so app.UseStaticFiles() can serve the prebuilt assets in
  production. Prior path ($(SpaRoot)build\**) did not match Stencil's
  output and would have left wwwroot empty.

Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant