Skip to content

Test the in-repo template engine samples instead of the published package - #57078

Closed
MiYanni wants to merge 3 commits into
dotnet:mainfrom
MiYanni:miyanni-microsoft-pin-template-samples-version
Closed

MiYanni wants to merge 3 commits into
dotnet:mainfrom
MiYanni:miyanni-microsoft-pin-template-samples-version

Conversation

@MiYanni

@MiYanni MiYanni commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

TemplateEngineSamplesTest installed the latest published Microsoft.TemplateEngine.Samples package, so publishing 11.0.100 (which drops FSharp.NET.Sdk from the F# sample) broke the checked-in sample06 --language F# snapshot.

The samples live in this repo (documentation/TemplateEngine/Samples), so the test now uses them directly instead of any package:

  • Microsoft.TemplateEngine.Samples.csproj marks its template content CopyToOutputDirectory (linked under TemplateEngineSamples/). The package layout is unchanged (verified the nupkg entries are identical).
  • dotnet-new.IntegrationTests.csproj has a ProjectReference (ReferenceOutputAssembly="false") to the samples project, so building the tests copies the templates into the test output.
  • TemplateEngineSamplesTest installs the TemplateEngineSamples folder from its output directory.
  • The F# snapshot is updated to the in-repo sample (plain Microsoft.NET.Sdk, no legacy package references).

Snapshots now always match the template content in the same commit.

Validated locally: all 16 TemplateEngineSamplesTest cases pass.

Fixes #57031

The test installed the latest package, so publishing 11.0.100 changed the generated F# project (FSharp.NET.Sdk removed) and broke the checked-in snapshot. Pin to 10.0.404, which the snapshots match.

Fixes dotnet#57031

Co-authored-by: Copilot App <[email protected]>
@MiYanni
MiYanni requested review from a team as code owners November 12, 2026 01:18
Copilot AI balanced review requested due to automatic review settings November 12, 2026 01:18
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

🟢 Approval recommended

No active review issues were identified for the package pin intended to prevent snapshot drift.

No open issues 🎉

What changed in this PR

Stabilizes the .NET SDK’s template sample integration tests against package-driven snapshot drift reported in #57031.

Changes:

  • Pins Microsoft.TemplateEngine.Samples to 10.0.404 instead of installing the latest release.
  • Adds a comment explaining the pin; existing snapshots remain unchanged.
File Description
test/​dotnet-new.IntegrationTests/​TemplateEngineSamplesTest.cs Pins the samples package during test initialization and documents why.

Review effort: Balanced

…he published one

Pack documentation/TemplateEngine/Samples as part of building dotnet-new.IntegrationTests and install that nupkg in TemplateEngineSamplesTest, replacing the unversioned install of the latest published package. Update the F# snapshot to match the in-repo sample.

Fixes dotnet#57031

Co-authored-by: Copilot App <[email protected]>
@MiYanni MiYanni changed the title Pin Microsoft.TemplateEngine.Samples version in samples test Test the in-repo Microsoft.TemplateEngine.Samples package Nov 12, 2026
…kage

Mark the samples content CopyToOutputDirectory (under TemplateEngineSamples/) so a ProjectReference copies it into the dotnet-new.IntegrationTests output, and install that folder in TemplateEngineSamplesTest. The package layout is unchanged.

Co-authored-by: Copilot App <[email protected]>
@MiYanni MiYanni changed the title Test the in-repo Microsoft.TemplateEngine.Samples package Test the in-repo template engine samples instead of the published package Nov 12, 2026
@MiYanni
MiYanni enabled auto-merge November 12, 2026 01:53
@MiYanni

MiYanni commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

/azp run dotnet-sdk-public-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@MiYanni

MiYanni commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

I've moved the changes from this PR into here: #57089

Both sets of changes were necessary for main to have a green build.

@MiYanni MiYanni closed this Nov 12, 2026
auto-merge was automatically disabled November 12, 2026 23:50

Pull request was closed

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.

[Known Build Error] F# sample template snapshot mismatch after unversioned package update

3 participants