-
Notifications
You must be signed in to change notification settings - Fork 848
Overhaul project template builds and testing #7113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jeffhandley
wants to merge
8
commits into
dotnet:main
Choose a base branch
from
jeffhandley:jeffhandley/template-testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Show resolved
Hide resolved
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj
Show resolved
Hide resolved
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj
Show resolved
Hide resolved
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj
Show resolved
Hide resolved
…ple packages resolved from a single project.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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