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

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)

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)

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.

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.

2 participants