Overhaul project template builds and testing#7113
Merged
jeffhandley merged 12 commits intodotnet:mainfrom Dec 19, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs a comprehensive overhaul of the project template build system and testing infrastructure. The primary goal is to improve maintainability by:
- Moving template content generation from MSBuild-generated files in
/srcto packaged NuGet content with version tokens replaced during build - Consolidating snapshot and execution tests into reusable base classes with parameterized tests
- Renaming template projects to align with template names (e.g.,
ChatWithCustomData-CSharp→AIChatWeb-CSharp) - Excluding
wwwrootstatic content fromaichatwebsnapshots to avoid large binary files in snapshots - Outputting all test artifacts to
/artifacts/ProjectTemplates/for improved discoverability
Reviewed changes
Copilot reviewed 115 out of 497 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
test/ProjectTemplates/**/*.cs |
Refactored snapshot and execution tests to use base classes and Theory tests; removed project-specific helper classes |
test/ProjectTemplates/Infrastructure/* |
Added reusable test utilities, base classes, and updated well-known paths to artifacts folder |
src/ProjectTemplates/Directory.Build.targets |
Added MSBuild task to generate template content with package version token replacement |
src/ProjectTemplates/Microsoft.*.Templates.csproj |
Updated to use TemplatePackageVersion items and TemplateContent preprocessing instead of generated content references |
src/ProjectTemplates/**/templates/** |
Renamed from src/* folders; changed .csproj files to .csproj-in with version tokens; updated namespace/project references |
src/ProjectTemplates/GeneratedContent.targets |
Removed file that defined template content generation with hardcoded versions |
test/ProjectTemplates/**/Snapshots/** |
Removed wwwroot folders from snapshots; updated snapshot naming scheme and placeholder tokens |
src/ProjectTemplates/README.md |
Updated documentation for new build process and template content generation |
9e657dc to
a5a9dfd
Compare
ericstj
reviewed
Dec 9, 2025
...ctTemplates/Microsoft.Agents.AI.ProjectTemplates/Microsoft.Agents.AI.ProjectTemplates.csproj
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj
Show resolved
Hide resolved
7b3c113 to
20eacea
Compare
59442bf to
2894d13
Compare
ericstj
reviewed
Dec 19, 2025
ericstj
reviewed
Dec 19, 2025
ericstj
reviewed
Dec 19, 2025
ericstj
approved these changes
Dec 19, 2025
Member
ericstj
left a comment
There was a problem hiding this comment.
Reviewed infrastructure and left a couple comments I trust you can address. I'm assuming test coverage is correct.
For things like this where we overhaul infrastructure I suggest diffing the outputs before/after to ensure the diff makes sense.
1. Remove unused AllowExplicitReference property on PackageReference 2. Remove SetTargetFramework to avoid possible unintended side effects 3. Simplify how the replacement properties are passed in for template content Also tighten up the Snapshot test AddPackageReferenceScrubber helper to ensure it only replaces version strings so that bugs in the MSBuild replacement logic that produce unexpected replacement strings do not get matched. This ensures the Snapshot tests fail if the version replacement logic is broken. As part of that, the scrubber helpers were moved into the VerifyScrubbers.cs file.
This was referenced Jan 19, 2026
Bump Microsoft.Extensions.AI.Abstractions from 10.1.1 to 10.2.0
modelcontextprotocol/csharp-sdk#1163
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request overhauls the way project template content is generated, how package versions are resolved for template projects, and how project template snapshot and execution tests are run.
The following goals are achieved, with the theme of substantially improving template maintenance:
/srcfolder during project template build, pack, or testingsrc, simplifying the projects and template infrastructure<ProjectReference />and<PackageVersion />items, with<PackageVersion />items for external packages defined in theDirectory.Packages.props-based imports<ProjectReference />-resolved version for a package within the repository, a template project can simply add<PackageVersion Update="Microsoft.Extensions.AI" Version="10.0.0" />(e.g.) into the project file. Otherwise, no template-specific versions need to be defined.[Theory]tests over the combinations of options to be tested-CSharpfolders was collapsed-CSharpname is still useful for a couple reasons, most importantly that this is part of thesourceNameused within the project template string replacement logic. When the-CSharpsuffix is removed, there are unintended matches on the tokens throughout the project template content./artifactsfolder during build and test, making them more discoverable and easier to navigate during development and testing. Runningcleanfor a template project will delete its/artifacts/ProjectTemplatesfolder./srcfolder, producing results that match the packed project templatenetstandard2.0rather than building multiple times against each target frameworkwwwrootfolder with its static contentDevelopment documentation was updated to reflect all of the changes.
The PR is broken into 6 commits, removing and readding the snapshots in commits flanking the actual overhaul work. There are two stages to the overhaul.
<TemplatePackageVersion />items that specifiedProjectand/orVersionproperties, with the versions defined within the template projects.<ProjectReference />and<PackageVersion />items to resolve the versions needed for the project templates. This iteration also addresses other MSBuild- and dev-innerloop-related feedback.While git isn't showing the snapshot changes as simple renames, there were not any functional changes to them. The changes to the snapshots reflect:
wwwrootfoldersThis PR is made ahead of other upcoming work on the project templates, where these changes will make it more straightforward to:
Microsoft Reviewers: Open in CodeFlow