Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 7, 2025

Fix deprecated :: separator in dotnet new update suggestions

This PR fixes the issue where dotnet new <sometemplate> suggests using the deprecated package::version syntax instead of the correct package@version syntax when advising about available upgrades.

Changes Completed:

  • Update TemplatePackageDisplay.cs DisplayUpdateCheckResult method (line 50, 58)
  • Update TemplatePackageCoordinator.cs DisplayUpdateCheckResult method (line 148, 156)
  • Update TemplatePackageDisplay.cs DisplayUpdateCheckResults method (line 306, 311)
  • Update TemplatePackageCoordinator.cs DisplayUpdateCheckResults method (line 847, 852)
  • Update other display strings that show package::version format (lines 71, 169, 318, 474, 636)
  • Update tests in DotnetNewUpdateTests.cs to validate the @ separator is used in suggestions
  • Build and verify changes compile successfully
  • All 20 integration tests for dotnet new update functionality pass
  • Fix approval tests for built-in package install scenarios
  • Add guidance to copilot instructions for dotnet/templating dependencies

Files Changed:

  1. src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageDisplay.cs (8 changes - string formatting only)
  2. src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageCoordinator.cs (14 changes - string formatting only)
  3. test/dotnet-new.IntegrationTests/DotnetNewUpdateTests.cs (24 changes)
  4. test/dotnet-new.IntegrationTests/DotnetNewInstallTests.Approval.cs (2 changes - dual scrubbers for :: and @)
  5. test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.Approval.cs (2 changes)
  6. test/dotnet-new.IntegrationTests/Approvals/*.verified.txt (4 approval files updated)
  7. .github/copilot-instructions.md (Added External Dependencies section)

Summary:

The fix replaces :: with @ in places where this repository directly constructs package version strings (e.g., $"{packageId}@{version}").

Note: DisplayName properties from the Microsoft.TemplateEngine.Edge package (such as InstallRequest.DisplayName and TemplatePackage.DisplayName) still use :: format and are not modified in this PR. These will be fixed at the source in dotnet/templating#9414.

This includes:

  • Update check notifications (single and bulk) - ✅ uses @
  • Built-in package availability warnings - ✅ uses @
  • Custom formatted package version strings - ✅ uses @
  • DisplayName properties from TemplateEngine.Edge - ⏳ still shows :: (to be fixed in dotnet/templating)

Copilot Instructions Update:

Added a new "External Dependencies" section to .github/copilot-instructions.md to document that changes requiring modifications to the dotnet/templating repository should be made directly in that repo rather than worked around in the SDK repository. This provides guidance for future contributors to avoid similar workarounds.

Example output (before):

An update for template package 'Aspire.ProjectTemplates::9.4.0' is available.
To update the package use:
   dotnet new install Aspire.ProjectTemplates::9.5.0

Example output (after):

An update for template package '[email protected]' is available.
To update the package use:
   dotnet new install [email protected]

Known Limitations:

Some messages that display template package names will continue to show :: format until the DisplayName properties are updated in the dotnet/templating repository:

  • "The following template packages will be installed: PackageName::Version"
  • "Success: PackageName::Version installed the following templates"
  • Force command suggestions using DisplayName

Testing:

✅ All 20 DotnetNewUpdateTests integration tests pass
✅ All 4 built-in package approval tests pass:

  • CanShowWarningIfPackageIsAvailableFromBuiltInSources
  • CanInstallPackageAvailableFromBuiltInsWithForce
  • CannotInstallPackageAvailableFromBuiltIns
  • CannotInstallMultiplePackageAvailableFromBuiltIns
    ✅ Manual testing confirms correct output
    ✅ Build succeeds with no warnings or errors

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

@Copilot Copilot AI changed the title [WIP] Fix deprecated syntax in dotnet new install command Fix dotnet new to suggest @ instead of deprecated :: separator in update notifications Oct 7, 2025
Copilot finished work on behalf of marcpopMSFT October 7, 2025 19:39
@Copilot Copilot AI requested a review from marcpopMSFT October 7, 2025 19:39
@marcpopMSFT
Copy link
Member

@copilot fix the templates tests that are failing because of the switch over from :: to @
CanShowWarningIfPackageIsAvailableFromBuiltInSources
CanInstallPackageAvailableFromBuiltInsWithForce
CannotInstallPackageAvailableFromBuiltIns
CannotInstallMultiplePackageAvailableFromBuiltIns

Copy link
Contributor Author

Copilot AI commented Oct 7, 2025

@copilot fix the templates tests that are failing because of the switch over from :: to @
CanShowWarningIfPackageIsAvailableFromBuiltInSources
CanInstallPackageAvailableFromBuiltInsWithForce
...

Fixed in commit 5a2929d. All 4 approval tests now pass:

  • CanShowWarningIfPackageIsAvailableFromBuiltInSources ✅
  • CanInstallPackageAvailableFromBuiltInsWithForce ✅
  • CannotInstallPackageAvailableFromBuiltIns ✅
  • CannotInstallMultiplePackageAvailableFromBuiltIns ✅

The changes ensure that all DisplayName usages now show @ instead of :: for package versions, including:

  • InstallRequest display names in package lists
  • Force command suggestions
  • Success messages after installation
  • Updated test scrubbers and approval files

Copilot finished work on behalf of marcpopMSFT October 7, 2025 23:48
@marcpopMSFT
Copy link
Member

@copilot you added .Replace of the :: in a couple of places. I don't think we should do that but rather should fix the source of that string if it's still a ::. Can you revert those .Replace calls and determine if there are other places in the templating code that are including the :: text?

Copy link
Contributor Author

Copilot AI commented Oct 9, 2025

@copilot you added .Replace of the :: in a couple of places. I don't think we should do that but rather should fix the source of that string if it's still a ::. Can you revert those .Replace calls and...

I've investigated the DisplayName sources. The InstallRequest.DisplayName and TemplatePackage.DisplayName properties are coming from the Microsoft.TemplateEngine.Edge package, which is an external NuGet dependency (referenced in Microsoft.TemplateEngine.Cli.csproj).

The DisplayName formatting with :: separator appears to be implemented in that external package. I don't see TemplateEngine.Edge source code in this repository - it's consumed as a package reference.

Could you clarify where the source code is that constructs these DisplayName strings? Is TemplateEngine.Edge source maintained in this repo, or should I look for a different architectural approach that doesn't involve string replacement?

@marcpopMSFT
Copy link
Member

@copilot The DisplayName strings come from the dotnet/templating repo that I also own. Plese revert the .Replace calls as we'll make the changes to the DisplayName in that repo. I've filed this issue to track that work: dotnet/templating#9414

Copy link
Contributor Author

Copilot AI commented Oct 10, 2025

@copilot The DisplayName strings come from the dotnet/templating repo that I also own. Plese revert the .Replace calls as we'll make the changes to the DisplayName in that repo. I've filed this issue ...

Reverted all .Replace("::", "@") calls on DisplayName properties in commit 8e3ea7c. The DisplayName properties from TemplateEngine.Edge now show :: format as they come from the package, which will be fixed in dotnet/templating#9414.

The changes in this PR now only replace :: with @ where we directly construct version strings (e.g., $"{packageId}@{version}"), not where we use DisplayName from the Edge package.

All 4 built-in package tests now pass with the updated approval files that expect :: for DisplayName-sourced strings and @ for our constructed strings.

@marcpopMSFT
Copy link
Member

@copilot Can you update the copilot instructions document to cover that in the future, any changes that require modifying dotnet/templating should not be worked around in this repo but made directly to that repo?

Copy link
Contributor Author

Copilot AI commented Oct 13, 2025

@copilot Can you update the copilot instructions document to cover that in the future, any changes that require modifying dotnet/templating should not be worked around in this repo but made directly t...

Updated .github/copilot-instructions.md in commit e8f5c2b. Added a new "External Dependencies" section that documents:

  • Changes requiring dotnet/templating modifications should be made directly in that repo, not worked around here
  • The dotnet/templating repository owns TemplateEngine packages
  • Guidance to file issues in dotnet/templating and make changes there for template engine behavior/formatting updates

Copilot finished work on behalf of marcpopMSFT October 13, 2025 20:38
@marcpopMSFT marcpopMSFT marked this pull request as ready for review October 14, 2025 23:54
@marcpopMSFT marcpopMSFT requested a review from a team as a code owner October 14, 2025 23:54
@marcpopMSFT marcpopMSFT requested a review from MiYanni October 14, 2025 23:55
@marcpopMSFT
Copy link
Member

I tested this in the codespace. There are a few other spaces where we still use :: but those come from templating so I had a similar PR made over there. The changes over here look right to me and worked when I tested them going through a few tool installs operations.

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