Merge dotnet/templating into dotnet/sdk (Phase 2: build integration and ProjectReference conversion)#53680
Merged
MichaelSimons merged 54 commits intodotnet:mainfrom Apr 17, 2026
Conversation
Directory.Packages.props: - Added FakeItEasy, JsonSchema.Net, Verify.*, xunit V3 packages - Added Microsoft.IO.Redist, NuGet.Credentials - Set StyleCop.Analyzers to explicit version 1.2.0-beta.556 - Added xunit.abstractions, xunit.extensibility.execution eng/Signing.props: - Added TemplateEngine non-shipping packages to signing exclusion list
Added src/TemplateEngine/Directory.Build.props: - Chains to repo root props via GetPathOfFileAbove - StrongNameKeyId: MicrosoftAspNetCore - GenerateDocumentationFile: true - StyleCop.Analyzers + PublicApiAnalyzers package references - Suppressed RS0016/RS0041 (Public API analyzer version differences) - Suppressed NU5105/NU5128/NU5100/NU5118/0419/0649 Added src/TemplateEngine/.editorconfig: - Migrated StyleCop rule suppressions from dotnet/templating - Downgraded IDE0005 to suggestion (multi-target implicit usings conflict) Root Directory.Build.props: - Added TemplateEngineRoot, TemplatesDir, NetFrameworkMinimum properties Updated all TE csproj/props files: - Replaced $(SrcDir) with $(TemplateEngineRoot) - Replaced $(ToolsDir) with $(TemplateEngineRoot)Tools/ - Replaced $(TestDir) with $(RepoRoot)test/TemplateEngine/
Now that TemplateEngine source is in-repo, convert external package references to in-tree project references: src/Cli/Microsoft.TemplateEngine.Cli: - Microsoft.TemplateEngine.Edge → ProjectReference - Microsoft.TemplateSearch.Common → ProjectReference src/Cli/dotnet: - Microsoft.TemplateEngine.Orchestrator.RunnableProjects → ProjectReference test/Microsoft.TemplateEngine.Cli.UnitTests: - Microsoft.TemplateEngine.Mocks → ProjectReference - Microsoft.TemplateEngine.TestHelper → ProjectReference - Microsoft.TemplateEngine.Orchestrator.RunnableProjects → ProjectReference test/dotnet-new.IntegrationTests: - Microsoft.TemplateEngine.TestHelper → ProjectReference - Microsoft.TemplateEngine.Authoring.TemplateVerifier → ProjectReference test/dotnet.Tests: - Microsoft.TemplateEngine.Mocks → ProjectReference - Microsoft.TemplateEngine.TestHelper → ProjectReference
Added /src/TemplateEngine/ folder with 8 source projects Added /src/TemplateEngine/Tools/ folder with 8 tool projects Added 19 TemplateEngine test projects to /test/ folder
test/Directory.Build.props: - Added _IsTemplateEngineTestProject detection property - StrongNameKeyId: MicrosoftAspNetCore for TE test projects (InternalsVisibleTo) - GenerateProgramFile: true for TE test projects (different test runner) - Suppressed IDE0005, CS0649, CA2016, CA5394, CA1802 for TE tests test/Directory.Build.targets: - Scoped FluentAssertions/TestFramework global usings to non-TE tests - Scoped Common/Program.cs inclusion to non-TE tests - TE test projects get minimal Xunit global using only test/UnitTests.proj: - Added TemplateEngine test template assets for Helix payload
- Removed duplicate PackageVersion entries (FakeItEasy, Verify.DiffPlex, Verify.XUnit) that conflicted with eng/dependabot/Packages.props - Bumped Microsoft.IO.Redist 6.0.1 → 6.1.0 (MSBuild transitive dependency) - Restored Microsoft.DotNet.Build.Tasks.Templating (Arcade package, not TE) to Version.Details.xml, Version.Details.props, and Directory.Packages.props - Fixed template.json schema path in RunnableProjects.UnitTests to use $(TemplateEngineRoot) instead of $(SolutionDir) - Fixed Authoring.Tasks.IntegrationTests Compile include to use $(TemplateEngineRoot)Tools\Shared instead of broken relative path
- Move NetFrameworkMinimum override from repo root to TemplateEngine scope - Remove signing exclusions from eng/Signing.props (Arcade handles non-shipping) - Inline package versions alphabetically in Directory.Packages.props - Fix Version.Details.xml formatting - Restore full .editorconfig (rules aren't covered by root editorconfig) - Remove redundant ExcludeFromSourceOnlyBuild (inherited from parent) - Move TemplateEngine test config into test/TemplateEngine/Directory.Build.props and test/TemplateEngine/Directory.Build.targets - Restore test/Directory.Build.props and test/Directory.Build.targets to original state (no TE-specific conditioning) - Remove only the global usings that TE tests don't reference (FluentAssertions, Microsoft.NET.TestFramework.*)
- Inline TemplateEngineRoot/TemplatesDir properties in Directory.Build.props - Add TODO comment for RS0016/RS0041 PublicAPI analyzer suppression - Simplify test/TemplateEngine/Directory.Build.targets - Update TemplateEngine.slnf to be a filter over sdk.slnx - Remove stale Microsoft.TemplateEngine.sln
- Restore all original projects in TemplateEngine.slnf that were inadvertently removed (Win32.Msi, NativeWrapper, SdkResolver, TemplateLocator.Tests) - Add template_feed/Microsoft.TemplateEngine.Authoring.Templates to slnf - Add TODO comments for migrating NetFrameworkMinimum to NetFrameworkToolCurrent in both src and test Directory.Build.props
Add TemplateEngineTestRoot property in Directory.Build.props pointing to test\TemplateEngine\. Replace all test/TemplateEngine/ references in csproj files with for consistency with the pattern used for source projects.
Replace relative paths (..\TemplateEngine\...) with in dotnet-new.IntegrationTests, dotnet.Tests, and Cli.UnitTests for consistency with TE-internal project references.
- Add Directory.Build.props/targets in test_templates/ to opt out of CPM (test templates are test assets with hardcoded PackageReference versions) - Fix TemplateEngineTestAssets paths in UnitTests.proj to include the TemplateEngine/ subdirectory prefix
- Add TemplateEnginePublicKey, DynamicProxyGenAssembly2PublicKey, and Deterministic properties to src/TemplateEngine/Directory.Build.props (brought forward from the templating repo) - Fix MockTemplateInfo obsolete interface properties to return empty collections instead of throwing NotImplementedException, which is incompatible with System.Text.Json serialization
The Newtonsoft → System.Text.Json migration changed the error message format when parsing corrupted JSON settings files. Update the Verify snapshots to match the new STJ exception message.
This was referenced Apr 3, 2026
Open
27d8cea to
c13875a
Compare
The Helix layout was copying TemplateEngine test templates into TestAssets/TestPackages/dotnet-new/, overwriting the SDK's standalone Microsoft.TemplateEngine.TestTemplates.csproj (which has net6.0 hardcoded) with the TemplateEngine version (which uses $(NetCurrent)). On Helix, $(NetCurrent) is undefined, causing dotnet pack to fail with NETSDK1013. Move TemplateEngine test assets to their own TestAssets/TestPackages/ TemplateEngine/ directory in the Helix payload to avoid clobbering the SDK's dotnet-new test assets.
c13875a to
4d7495b
Compare
…ase2 # Conflicts: # Directory.Packages.props # eng/Version.Details.xml # test/Microsoft.TemplateEngine.Cli.UnitTests/Microsoft.TemplateEngine.Cli.UnitTests.csproj # test/dotnet-new.IntegrationTests/dotnet-new.IntegrationTests.csproj # test/dotnet.Tests/dotnet.Tests.csproj
The following projects were duplicated with XunitV3 suffixes to support xunit v3 testing while the main codebase was still on xunit v2. Now that the xunit v3 migration is complete, the originals are v3 and these variants are redundant: - Microsoft.TemplateEngine.Mocks.XunitV3 - Microsoft.TemplateEngine.TestHelper.XunitV3 - Microsoft.TemplateEngine.Authoring.TemplateVerifier.XunitV3 - Microsoft.TemplateEngine.Authoring.TemplateApiVerifier.XunitV3 - Microsoft.TemplateEngine.Authoring.TemplateVerifier.IntegrationTests.XunitV3 - Microsoft.TemplateEngine.Authoring.TemplateVerifier.UnitTests.XunitV3 Verified no other repos in the VMR reference the v2 variants.
Now that the SDK repo has completed the xunit v3 migration, update the original templating engine projects to use xunit v3 directly: keeping only the v3 code paths - Replace xunit v2 package references with v3 equivalents: - xunit.abstractions -> xunit.v3.extensibility.core - xunit.extensibility.execution -> xunit.v3.extensibility.core - Xunit -> xunit.v3.assert + xunit.v3.extensibility.core - Verify.Xunit / Verify.XUnit -> Verify.XunitV3 - Update using Xunit.Abstractions -> using Xunit / using Xunit.Sdk - Implement additional ITestOutputHelper members (Write, Output) required by xunit v3 in TestOutputLogger - Remove dead DummyMethod from VerificationEngine.cs - Update Verify.XunitV3 version to 28.12.0 in dependabot/Packages.props
…context These tests run the CLI tool as a subprocess which calls Verifier.VerifyDirectory() from Verify.XunitV3. Without an xUnit test runner in the subprocess, TestContext.TestMethod is null causing exit code 70 instead of 65. dotnet#53889 Co-authored-by: Copilot <[email protected]>
Add ApprovalsDirectory and SnapshotsDirectory properties to TestBase so all test projects use a single definition instead of repeating Path.Combine(AppContext.BaseDirectory, ...) at every call site. Co-authored-by: Copilot <[email protected]>
Replace raw AppContext.BaseDirectory + test_templates path with the existing TestBase helper property for consistency. Co-authored-by: Copilot <[email protected]>
- Add SetupNuGetConfigForPackagesLocation helper to TestBase - Remove unnecessary TestTemplates ProjectReferences (CLI, TemplateVerifier, TemplateLocalizer) — tests access templates via TestBase.TestTemplatesLocation - TemplateLocalizer: link Shared/TestBase.cs and use TestTemplatesLocation - Reduce Directory.Build.targets Using removes from 6 to 2 (only the ones with actual type conflicts remain) Co-authored-by: Copilot <[email protected]>
The SampleDogfoodTest uses UniqueFor=Architecture but only x64 snapshots existed, causing verification failures on macOS arm64 Helix workers. Co-authored-by: Copilot <[email protected]>
$(Version) is empty when the GeneratedText property is evaluated because SDK versioning targets haven't been imported yet. Use a placeholder in GeneratedText and substitute $(Version) inside the AddGeneratedFile target where it is available. Co-authored-by: Copilot <[email protected]>
…ility This project targets netstandard2.0, but the latest NuGet packages used by the rest of the SDK have dropped netstandard support. VersionOverride pins these to an older netstandard-compatible version. Co-authored-by: Copilot <[email protected]>
Member
Author
|
@NikolaMilosavljevic - This is ready for review now. The last PR validation passed with the exception of a number of known failures in main. |
Co-authored-by: Copilot <[email protected]>
The TemplateEngine test Directory.Build.props was overriding GenerateProgramFile to true, but this is unnecessary because xUnit v3's _XunitGenerateEntryPoint target automatically generates the entry point for test projects. This aligns TemplateEngine tests with the rest of the SDK test projects which rely on the repo-root setting of GenerateProgramFile=false. Co-authored-by: Copilot <[email protected]>
The Approvals files were included as both Content and None items. The Content include is redundant since the None include with CopyToOutputDirectory is sufficient to copy files to the output directory. Co-authored-by: Copilot <[email protected]>
…imons/sdk into merge-templating-phase2
NikolaMilosavljevic
approved these changes
Apr 16, 2026
Replace inline Path.Combine(AppContext.BaseDirectory, "Snapshots") with TestBase.SnapshotsDirectory to be consistent with the IntegrationTests project. Added Shared file compilation to the UnitTests Shared.props to make TestBase accessible. Co-authored-by: Copilot <[email protected]>
NikolaMilosavljevic
approved these changes
Apr 16, 2026
MiYanni
approved these changes
Apr 17, 2026
Member
Author
|
/ba-g all known failures. |
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 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.
Phase 2 of the dotnet/templating → dotnet/sdk merge. Phase 1 (#53647) brought in the source files with preserved commit history. This phase integrates the TemplateEngine projects into the SDK build system.
Changes
Dependency removal
eng/Version.Details.xmlandDirectory.Packages.propsBuild infrastructure
TemplateEngSrcDir,TemplateEngTestDir, andTemplateEngTestAssetsDirproperties for consistent path references across the buildProjectReference conversion
PackageReferences toProjectReferences so the SDK builds the TemplateEngine source directly instead of consuming pre-built packagesSolution integration
sdk.slnxsource-build.slnfxUnit v3 migration
Microsoft.TemplateEngine.Mocks.XunitV3Microsoft.TemplateEngine.TestHelper.XunitV3Microsoft.TemplateEngine.Authoring.TemplateVerifier.XunitV3Microsoft.TemplateEngine.Authoring.TemplateApiVerifier.XunitV3Microsoft.TemplateEngine.Authoring.TemplateVerifier.IntegrationTests.XunitV3Microsoft.TemplateEngine.Authoring.TemplateVerifier.UnitTests.XunitV3Test infrastructure
Related
dotnet/templatingintodotnet/sdktemplating#10085