Add local dotnet tool manifest for EF and trx-to-vsplaylist and validate EF migrations in CI#1017
Conversation
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/9b04f6f3-5e68-4c08-af16-34313a9169d1 Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
|
@copilot can we add dotnet ef migrations has-pending-model-changes to our ci pipeline and a dotnet tool restore before then to get the ef tooling in? |
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/3732bf6c-e6ba-4e30-a7e4-83933137a7fc Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
Implemented in 3886338. The PR workflow now runs |
There was a problem hiding this comment.
Pull request overview
Adds a repository-local .NET tool manifest and updates PR CI to restore those tools and enforce EF Core migration drift checks.
Changes:
- Add
.config/dotnet-tools.jsonto pin local versions ofdotnet-efandtrx-to-vsplaylist. - Update PR workflow to
dotnet tool restorebefore build steps that rely on tooling. - Add
dotnet ef migrations has-pending-model-changesto fail CI when migrations drift from the current model.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/PR-Build-And-Test.yml | Restores local tools and adds an EF Core pending-model-changes validation step in PR CI. |
| .config/dotnet-tools.json | Introduces a local tool manifest pinning dotnet-ef and trx-to-vsplaylist. |
| run: dotnet build --configuration Release --no-restore /p:AccessToNugetFeed=false | ||
|
|
||
| - name: Check for pending EF Core model changes | ||
| run: dotnet ef migrations has-pending-model-changes --project EssentialCSharp.Web --configuration Release --no-build |
There was a problem hiding this comment.
dotnet tool restore installs dotnet-ef as a local tool, but this step calls dotnet ef ..., which typically relies on dotnet-ef being discoverable as a CLI extension on PATH (often via a global tool install). To ensure CI uses the restored local tool and doesn’t depend on runner/global state, invoke it via dotnet tool run dotnet-ef -- migrations has-pending-model-changes ... (or otherwise ensure the local tool is on PATH).
| run: dotnet ef migrations has-pending-model-changes --project EssentialCSharp.Web --configuration Release --no-build | |
| run: dotnet tool run dotnet-ef -- migrations has-pending-model-changes --project EssentialCSharp.Web --configuration Release --no-build |
| "isRoot": true, | ||
| "tools": { | ||
| "dotnet-ef": { | ||
| "version": "10.0.7", |
There was a problem hiding this comment.
The manifest pins dotnet-ef to 10.0.7, but the web project references Microsoft.EntityFrameworkCore.Tools 10.0.6 (see Directory.Packages.props). EF tooling is sensitive to version mismatches; consider aligning these versions (either bump the package to 10.0.7 or pin the tool to 10.0.6) to avoid CLI/runtime incompatibilities.
| "version": "10.0.7", | |
| "version": "10.0.6", |
Summary
.config/dotnet-tools.jsonto pin repository-local versions ofdotnet-efandtrx-to-vsplaylistdotnet tool restorewithout requiring global installsdotnet tool restorebefore EF tooling is useddotnet ef migrations has-pending-model-changesto the PR CI pipeline so migration drift fails validationValidation
dotnet tool restoredotnet tool run dotnet-ef --versiondotnet tool run trx-to-vsplaylist --helpdotnet build EssentialCSharp.Web.slnx --configuration ReleaseASPNETCORE_ENVIRONMENT=Development dotnet ef migrations has-pending-model-changes --project EssentialCSharp.Web --configuration Release --no-builddotnet test --solution EssentialCSharp.Web.slnx --configuration Release --no-build(fails with the same pre-existing integration test failures:CaptchaService_Verify_SuccessandKnownBreachedPassword_IsDetected)