Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

The console template includes a legacy comment // See https://aka.ms/new-console-template for more information that should be removed, resulting in cleaner template output with just the Console.WriteLine statement.

Changes

  • Template: Removed comment conditional block from ConsoleApplication-CSharp/Program.cs (.NET 10 template)
  • Test assets: Removed comment from 8 test project files
  • Approval baselines: Updated 4 snapshot files for .NET 10 (baselines without explicit framework specification)
  • Framework-specific baselines: Kept comment in 9 baseline files for .NET 6/7/8 frameworks (these use external NuGet packages that still contain the comment)

Result

// .NET 10 (current development) - After
Console.WriteLine("Hello, World!");

// .NET 6/7/8 (from external NuGet packages) - Unchanged
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

Note

The FeaturesSupport tests install external template packages from NuGet for .NET 6, 7, 8, and 9. These released packages still contain the comment. Only the .NET 10 template (current development version) has been updated to remove the comment. Tests with explicit --framework net6.0/7.0/8.0 continue to use and expect the comment from those external packages.

Fixes the issue from previous PR #42497 by correctly targeting only .NET 10 baselines.

Original prompt

The template that's used for new console apps starts with this legacy comment: "// See https://aka.ms/new-console-template for more information". I need you to update the repo to remove that comment from everywhere it appears, such that creating a new console app results in just the single Console.WriteLine call. This will entail updating snapshot baseline files as well. (You can see a previous attempt at this in #42497, but it neglected to update the baselines and thus didn't pass CI checks.)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot AI changed the title The template that's used for new console apps starts with this legacy comment: "// See https://aka.ms/new-console-template for more information". I need you to update the repo to remove that comment from everywhere it appears, such that creating a new ... Remove legacy console template comment Nov 3, 2025
Copilot finished work on behalf of stephentoub November 3, 2025 15:32
Copilot AI requested a review from stephentoub November 3, 2025 15:32
@stephentoub stephentoub marked this pull request as ready for review November 3, 2025 15:36
@stephentoub stephentoub requested a review from a team as a code owner November 3, 2025 15:36
@stephentoub
Copy link
Member

Replaces #51527

@stephentoub stephentoub enabled auto-merge (squash) November 3, 2025 15:38
Copy link
Contributor

Copilot AI left a 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 removes the introductory comment "// See https://aka.ms/new-console-template for more information" from console application templates and their associated test approval files. The change simplifies the generated console application code by eliminating an informational comment that pointed to template documentation.

Key changes:

  • Removed the documentation comment from the main console template source
  • Updated all test approval files to reflect the cleaner generated output

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

File Description
template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/ConsoleApplication-CSharp/Program.cs Removed the conditional comment block that displayed template documentation URL for top-level programs
test/dotnet-new.IntegrationTests/Approvals/* (multiple files) Updated test approval files to match the new template output without the documentation comment
test/TestAssets/TestProjects/* (multiple files) Updated test asset files to align with the new template format

@baronfel
Copy link
Member

baronfel commented Nov 3, 2025

@copilot the Microsoft.DotNet.Cli.New.IntegrationTests.CommonTemplatesTests.FeaturesSupport tests for the console are still failing despire the changes you made. Please investigate:

Microsoft.TemplateEngine.Authoring.TemplateVerifier.TemplateVerificationException : Directory: /Users/runner/work/1/s/test/dotnet-new.IntegrationTests/Approvals
NotEqual:
  - Received: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.received/MyProject/Program.cs
    Verified: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.verified/MyProject/Program.cs
Equal:
  - Received: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.received/MyProject/console.csproj
    Verified: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.verified/MyProject/console.csproj
  - Received: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.received/std-streams/stdout.txt
    Verified: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.verified/std-streams/stdout.txt

FileContent:

NotEqual:

Received: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.received/MyProject/Program.cs
Verified: FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#Framework-net8.0#cs.verified/MyProject/Program.cs
Compare Result:
  [BOF]
+ // See https://aka.ms/new-console-template for more information
2 Console.WriteLine("Hello, World!");

@stephentoub
Copy link
Member

@copilot, please address the failing tests / @baronfel's comments

…template packages

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
auto-merge was automatically disabled November 3, 2025 18:17

Head branch was pushed to by a user without write access

Copy link
Contributor Author

Copilot AI commented Nov 3, 2025

@copilot the Microsoft.DotNet.Cli.New.IntegrationTests.CommonTemplatesTests.FeaturesSupport tests for the console are still failing despire the changes you made. Please investigate:

...

Fixed in commit 849c41b.

The issue was that tests with explicit framework targets (net6.0, net7.0, net8.0) use external NuGet packages that still contain the comment. I reverted the baseline changes for those framework-specific tests while keeping the changes for .NET 10 (current) baselines and the template source.

The FeaturesSupport tests install template packages from NuGet for older frameworks, so those tests need baselines that match the released templates (with comment). Only tests without explicit framework specifications use the .NET 10 template (without comment).

@copilot, please address the failing tests / @baronfel's comments

Addressed in commit 849c41b.

Root cause: The FeaturesSupport tests install external NuGet packages for .NET 6/7/8/9 templates from ~/.nuget/packages/ which still contain the comment (they're released versions). Tests with --framework net6/7/8 use those packages, not the .NET 10 template I modified.

Solution: Reverted baseline changes for framework-specific tests (net6/7/8) so they expect the comment from the external packages. Kept changes for .NET 10 template and baselines without framework specifications.

Verified: .NET 10 console apps now generate without the comment: Console.WriteLine("Hello, World!");

Copilot AI changed the title Remove legacy console template comment Remove legacy console template comment from .NET 10 console template Nov 3, 2025
Copilot AI requested a review from stephentoub November 3, 2025 18:23
Copilot finished work on behalf of stephentoub November 3, 2025 18:23
@baronfel
Copy link
Member

baronfel commented Nov 3, 2025

/ba-g known issue

@baronfel baronfel merged commit 026ef57 into main Nov 3, 2025
28 of 30 checks passed
@baronfel baronfel deleted the copilot/fix-9141961-63984307-6c730679-58ce-418a-b80c-c3d51fab7e1c branch November 3, 2025 22:29
@stephentoub
Copy link
Member

/backport to release/10.0.2xx

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Started backporting to release/10.0.2xx (link to workflow run)

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