Skip to content

Document and repair local template validation - #68899

Merged
javiercn merged 3 commits into
mainfrom
javiercn-template-validation-guidance
Sep 1, 2026
Merged

javiercn merged 3 commits into
mainfrom
javiercn-template-validation-guidance

Conversation

@javiercn

@javiercn javiercn commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add repository-specific ProjectTemplates preflight and completion guidance
  • document a step-by-step package, generated-app, manual run, probe, and cleanup workflow
  • consolidate all 22 Run-*-Locally.ps1 entry points on one fail-fast helper and remove stale package versions/options
  • distinguish area package validation, full package/runtime production, focused Templates.Tests preparation, and application-boundary validation

This follow-up was originally developed from the validation evidence for #68898, which is now merged into main.

Bootstrap validation evidence

The ProjectTemplates area pack produced the four template nupkgs but not the runtime archive, complete Shipping/NonShipping package graph, or generated Templates.Tests imports required by locally generated applications. Direct delayed-project selection required OnlyTestProjectTemplates=true. On Windows, -NoBuildInstallers excluded installer projects but runtime/ref packs still invoked wix.exe; applying GenerateInstallers=false to that full graph removed a target those packs still expected. A missing local source had to be fixed by running its producer, not by creating an empty directory.

The script audit also found legacy Debug-only paths, exact 11.0.0-dev package filenames, a bare ambiguous dotnet pack, removed template options (--hosted, -aot, and -minimal), multi-RID restore failures for MCP/native-AOT variants, and a same-shell rerun failure after the helper prepended its isolated SDK.

Validation

  • ProjectTemplates Release area pack succeeded
  • focused Release Templates.Tests producer build succeeded with OnlyTestProjectTemplates=true, GenerateInstallers=false, and -NoBuildDeps
  • all 22 local script default argument sets passed dotnet new --dry-run
  • Web API published and returned five /weatherforecast results
  • Blazor Web published and returned its generated home page
  • Worker published, remained active, and emitted its recurring execution log
  • gRPC published, remained active, and accepted a connection on its configured endpoint
  • MCP published and completed a JSON-RPC initialize exchange
  • consecutive Web API and Worker scripts succeeded in one activated shell
  • all 23 PowerShell entry/helper files parse successfully
  • git diff --check

The full product pack produced the package graph, runtime archive, and test inputs used above, but the overall repository build later stopped because wix.exe was unavailable on this machine; the README now names that Windows prerequisite.

@javiercn
javiercn requested review from a team and wtgodbe as code owners August 28, 2026 21:19
Base automatically changed from javiercn-update-bootstrap-5-3-8 to main September 1, 2026 10:06
@javiercn
javiercn requested a review from a team as a code owner September 1, 2026 10:06
@javiercn
javiercn force-pushed the javiercn-template-validation-guidance branch from aa88251 to fda686c Compare September 1, 2026 10:38
javiercn and others added 2 commits September 1, 2026 15:31
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 740028aa-f9af-4e33-831a-425d403b0ab3
@javiercn
javiercn force-pushed the javiercn-template-validation-guidance branch from fda686c to 868b9bf Compare September 1, 2026 13:32
Copilot AI lite review requested due to automatic review settings September 1, 2026 13:32
@javiercn javiercn changed the title Document ProjectTemplates validation prerequisites Document and repair local template validation Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the ProjectTemplates local-validation workflow by consolidating all Run-*-Locally.ps1 entry points onto a single fail-fast PowerShell module helper and by expanding the ProjectTemplates documentation/guidance so contributors can reliably validate generated application behavior (not just packaging).

Changes:

  • Replaced the legacy Test-Template.ps1 approach with a reusable Test-Template.psm1 module that repacks, (re)installs, generates, patches imports, and publishes templates in a consistent way.
  • Updated all local runner scripts to import the module and to use explicit argument arrays (and standardized options like --aot, --minimal, etc.).
  • Added/expanded ProjectTemplates guidance and documentation to distinguish package-only validation vs. full product/package graph + generated-app validation workflows.
File summaries
File Description
src/ProjectTemplates/scripts/Test-Template.psm1 New consolidated helper that validates prerequisites, repacks/reinstalls templates, patches imports, and publishes generated apps.
src/ProjectTemplates/scripts/Test-Template.ps1 Removed legacy helper script superseded by the module.
src/ProjectTemplates/scripts/Run-WorkerProgramMain-Locally.ps1 Switched to importing Test-Template.psm1 and passing structured args.
src/ProjectTemplates/scripts/Run-WorkerNativeAot-Locally.ps1 Uses module + publish args for win-x64/AOT scenario.
src/ProjectTemplates/scripts/Run-Worker-Locally.ps1 Uses module + structured args.
src/ProjectTemplates/scripts/Run-WebApiProgamMainMinimal-Locally.ps1 Uses module + structured args for Program.Main + minimal APIs variant.
src/ProjectTemplates/scripts/Run-WebApiProgamMain-Locally.ps1 Uses module + structured args for Program.Main variant.
src/ProjectTemplates/scripts/Run-WebApiMinimal-Locally.ps1 Uses module + long-form --minimal arg.
src/ProjectTemplates/scripts/Run-WebApiAotProgramMain-Locally.ps1 Uses module + publish args for win-x64 AOT Program.Main variant.
src/ProjectTemplates/scripts/Run-WebApiAot-Locally.ps1 Uses module + publish args for win-x64 AOT variant.
src/ProjectTemplates/scripts/Run-WebApi-Locally.ps1 Uses module + structured args.
src/ProjectTemplates/scripts/Run-StarterwebProgramMain-Locally.ps1 Uses module + structured args for MVC Program.Main + auth variant.
src/ProjectTemplates/scripts/Run-Starterweb-Locally.ps1 Appends remaining args and uses module-based helper.
src/ProjectTemplates/scripts/Run-RazorProgramMain-Locally.ps1 Normalized to pwsh, added strict mode/error preference, and uses module helper.
src/ProjectTemplates/scripts/Run-Razor-Locally.ps1 Appends remaining args and uses module-based helper.
src/ProjectTemplates/scripts/Run-McpServer-Locally.ps1 Uses module helper with MCP template package/project paths + publish args.
src/ProjectTemplates/scripts/Run-GrpcNativeAot-Locally.ps1 Uses module + publish args for win-x64 AOT variant.
src/ProjectTemplates/scripts/Run-gRPC-Locally.ps1 Uses module + structured args.
src/ProjectTemplates/scripts/Run-EmptyWebProgramMain-Locally.ps1 Uses module + structured args for Program.Main variant.
src/ProjectTemplates/scripts/Run-EmptyWeb-Locally.ps1 Uses module + structured args.
src/ProjectTemplates/scripts/Run-BlazorWeb-Locally.ps1 Uses module helper; forwards remaining args and -NoRestore.
src/ProjectTemplates/scripts/Run-BlazorWasmServiceDefaults-Locally.ps1 Forwards remaining args and uses module helper for service-defaults template.
src/ProjectTemplates/scripts/Run-BlazorWasmProgramMain-Locally.ps1 Uses module helper and structured args (Program.Main variant).
src/ProjectTemplates/scripts/Run-BlazorWasm-Locally.ps1 Uses module helper; forwards remaining args and -NoRestore.
src/ProjectTemplates/README.md Expanded step-by-step local build + generated-app validation workflow and clarified prerequisites (including WiX).
src/ProjectTemplates/README-BASELINES.md Updated baseline workflow to reference the new README workflow + local scripts.
src/ProjectTemplates/AGENTS.md Added ProjectTemplates-specific preflight and validation-boundary guidance for contributors/agents.
.github/instructions/project-templates.instructions.md Hooks ProjectTemplates-specific guidance into GitHub Copilot instructions for that folder.
.github/copilot-instructions.md Adds guidance about reporting blocked automated tests and the fallback validation boundary used.
Review details
  • Files reviewed: 29/29 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 740028aa-f9af-4e33-831a-425d403b0ab3
@javiercn

javiercn commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

/ba-g got stuck

@javiercn
javiercn merged commit 4330aba into main Sep 1, 2026
30 checks passed
@javiercn
javiercn deleted the javiercn-template-validation-guidance branch September 1, 2026 17:43
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 2, 2026
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.

3 participants