diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 00e3e87beec2..77746c7f5bcd 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -26,3 +26,8 @@ Localization: Documentation: - Do not manually edit files under documentation/manpages/sdk as these are generated based on documentation and should not be manually modified. + +External Dependencies: +- Changes that require modifications to the dotnet/templating repository (Microsoft.TemplateEngine packages) should be made directly in that repository, not worked around in this repo. +- The dotnet/templating repository owns the TemplateEngine.Edge, TemplateEngine.Abstractions, and related packages. +- If a change requires updates to template engine behavior or formatting (e.g., DisplayName properties), file an issue in dotnet/templating and make the changes there rather than adding workarounds in this SDK repository. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageCoordinator.cs b/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageCoordinator.cs index ad5166cc91b0..22da91898061 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageCoordinator.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageCoordinator.cs @@ -145,7 +145,7 @@ internal void DisplayUpdateCheckResult(CheckUpdateResult versionCheckResult, ICo { if (!versionCheckResult.IsLatestVersion) { - string displayString = $"{versionCheckResult.TemplatePackage?.Identifier}::{versionCheckResult.TemplatePackage?.Version}"; // the package::version currently installed + string displayString = $"{versionCheckResult.TemplatePackage?.Identifier}@{versionCheckResult.TemplatePackage?.Version}"; // the package@version currently installed Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Update_Info_UpdateAvailable, displayString); Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Update_Info_UpdateSingleCommandHeader); @@ -153,7 +153,7 @@ internal void DisplayUpdateCheckResult(CheckUpdateResult versionCheckResult, ICo Example .For(args.ParseResult) .WithSubcommand() - .WithArgument(BaseInstallCommand.NameArgument, $"{versionCheckResult.TemplatePackage?.Identifier}::{versionCheckResult.LatestVersion}")); + .WithArgument(BaseInstallCommand.NameArgument, $"{versionCheckResult.TemplatePackage?.Identifier}@{versionCheckResult.LatestVersion}")); Reporter.Output.WriteLine(); } } @@ -166,7 +166,7 @@ internal void DisplayUpdateCheckResult(CheckUpdateResult versionCheckResult, ICo internal void DisplayBuiltInPackagesCheckResult(string packageId, string version, string provider, ICommandArgs args) { - Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_BuiltInCheck_Info_BuiltInPackageAvailable, $"{packageId}::{version}", provider); + Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_BuiltInCheck_Info_BuiltInPackageAvailable, $"{packageId}@{version}", provider); Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_BuiltInCheck_Info_UninstallPackage); Reporter.Output.WriteCommand( Example @@ -315,7 +315,7 @@ internal async Task EnterUpdateFlowAsync(UpdateCommandArgs com Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Update_Info_PackagesToBeUpdated); foreach (CheckUpdateResult update in updatesToApply) { - Reporter.Output.WriteLine($"{update.TemplatePackage!.Identifier}::{update.LatestVersion}".Indent()); + Reporter.Output.WriteLine($"{update.TemplatePackage!.Identifier}@{update.LatestVersion}".Indent()); } Reporter.Output.WriteLine(); @@ -471,7 +471,7 @@ internal async Task DisplayTemplatePackageMetadata( Reporter.Output.WriteLine( LocalizableStrings.Generic_Info_NoMatchingTemplatePackage.Bold().Red(), - $"{packageIdentity}{(string.IsNullOrWhiteSpace(packageVersion) ? string.Empty : $"::{packageVersion}")}"); + $"{packageIdentity}{(string.IsNullOrWhiteSpace(packageVersion) ? string.Empty : $"@{packageVersion}")}"); return NewCommandStatus.NotFound; } @@ -633,7 +633,7 @@ private async Task ValidateInstallationRequestsAsync(InstallCommandArgs ar reporter.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Install_Info_PackageIsAvailable); foreach (var request in invalidTemplatePackages) { - reporter.WriteLine($"{request.PackageInfo.Id}::{request.PackageInfo.Version}".Indent()); + reporter.WriteLine($"{request.PackageInfo.Id}@{request.PackageInfo.Version}".Indent()); } reporter.WriteLine(); @@ -844,12 +844,12 @@ private void DisplayUpdateCheckResults(IEnumerable versionChe Example .For(args.ParseResult) .WithSubcommand() - .WithArgument(BaseInstallCommand.NameArgument, $"::")); + .WithArgument(BaseInstallCommand.NameArgument, $"@")); Reporter.Output.WriteCommand( Example .For(args.ParseResult) .WithSubcommand() - .WithArgument(BaseInstallCommand.NameArgument, $"{displayableResults.First().Identifier}::{displayableResults.First().LatestVersion}")); + .WithArgument(BaseInstallCommand.NameArgument, $"{displayableResults.First().Identifier}@{displayableResults.First().LatestVersion}")); Reporter.Output.WriteLine(); Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Update_Info_UpdateAllCommandHeader); Reporter.Output.WriteCommand( diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageDisplay.cs b/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageDisplay.cs index b0e29d105681..4af28fdd7f97 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageDisplay.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageDisplay.cs @@ -47,7 +47,7 @@ internal void DisplayUpdateCheckResult(CheckUpdateResult versionCheckResult, ICo { if (!versionCheckResult.IsLatestVersion) { - string displayString = $"{versionCheckResult.TemplatePackage?.Identifier}::{versionCheckResult.TemplatePackage?.Version}"; // the package::version currently installed + string displayString = $"{versionCheckResult.TemplatePackage?.Identifier}@{versionCheckResult.TemplatePackage?.Version}"; // the package@version currently installed _reporterOutput.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Update_Info_UpdateAvailable, displayString); _reporterOutput.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Update_Info_UpdateSingleCommandHeader); @@ -55,7 +55,7 @@ internal void DisplayUpdateCheckResult(CheckUpdateResult versionCheckResult, ICo Example .For(args.ParseResult) .WithSubcommand() - .WithArgument(BaseInstallCommand.NameArgument, $"{versionCheckResult.TemplatePackage?.Identifier}::{versionCheckResult.LatestVersion}")); + .WithArgument(BaseInstallCommand.NameArgument, $"{versionCheckResult.TemplatePackage?.Identifier}@{versionCheckResult.LatestVersion}")); _reporterOutput.WriteLine(); } } @@ -68,7 +68,7 @@ internal void DisplayUpdateCheckResult(CheckUpdateResult versionCheckResult, ICo internal void DisplayBuiltInPackagesCheckResult(string packageId, string version, string provider, ICommandArgs args) { - _reporterOutput.WriteLine(LocalizableStrings.TemplatePackageCoordinator_BuiltInCheck_Info_BuiltInPackageAvailable, $"{packageId}::{version}", provider); + _reporterOutput.WriteLine(LocalizableStrings.TemplatePackageCoordinator_BuiltInCheck_Info_BuiltInPackageAvailable, $"{packageId}@{version}", provider); _reporterOutput.WriteLine(LocalizableStrings.TemplatePackageCoordinator_BuiltInCheck_Info_UninstallPackage); _reporterOutput.WriteCommand( Example @@ -303,12 +303,12 @@ internal void DisplayUpdateCheckResults(IEngineEnvironmentSettings engineEnviron Example .For(args.ParseResult) .WithSubcommand() - .WithArgument(BaseInstallCommand.NameArgument, $"::")); + .WithArgument(BaseInstallCommand.NameArgument, $"@")); Reporter.Output.WriteCommand( Example .For(args.ParseResult) .WithSubcommand() - .WithArgument(BaseInstallCommand.NameArgument, $"{displayableResults.First().Identifier}::{displayableResults.First().LatestVersion}")); + .WithArgument(BaseInstallCommand.NameArgument, $"{displayableResults.First().Identifier}@{displayableResults.First().LatestVersion}")); Reporter.Output.WriteLine(); Reporter.Output.WriteLine(LocalizableStrings.TemplatePackageCoordinator_Update_Info_UpdateAllCommandHeader); Reporter.Output.WriteCommand( diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CanInstallPackageAvailableFromBuiltInsWithForce.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CanInstallPackageAvailableFromBuiltInsWithForce.verified.txt index 144ea5cc69e7..9ee051e49339 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CanInstallPackageAvailableFromBuiltInsWithForce.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CanInstallPackageAvailableFromBuiltInsWithForce.verified.txt @@ -3,7 +3,7 @@ Installing the template package(s) will override the available template package(s). The following template package(s) are already available: - Microsoft.DotNet.Common.ItemTemplates::%VERSION% + Microsoft.DotNet.Common.ItemTemplates@%VERSION% Success: Microsoft.DotNet.Common.ItemTemplates::6.0.100 installed the following templates: Template Name Short Name Language Tags diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CannotInstallPackageAvailableFromBuiltIns.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CannotInstallPackageAvailableFromBuiltIns.verified.txt index d8b4586ef0eb..1006e1eb33c6 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CannotInstallPackageAvailableFromBuiltIns.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstallTests.CannotInstallPackageAvailableFromBuiltIns.verified.txt @@ -1,6 +1,6 @@ Installing the template package(s) will override the available template package(s). The following template package(s) are already available: - Microsoft.DotNet.Common.ItemTemplates::%VERSION% + Microsoft.DotNet.Common.ItemTemplates@%VERSION% To install the template package(s) anyway, apply '--force' option: dotnet new install Microsoft.DotNet.Common.ItemTemplates::6.0.100 --force diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstantiateTests.CanShowWarningIfPackageIsAvailableFromBuiltInSources.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstantiateTests.CanShowWarningIfPackageIsAvailableFromBuiltInSources.verified.txt index a847f252abcc..0c3ad4b27637 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstantiateTests.CanShowWarningIfPackageIsAvailableFromBuiltInSources.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewInstantiateTests.CanShowWarningIfPackageIsAvailableFromBuiltInSources.verified.txt @@ -1,9 +1,9 @@ The template "dotnet gitignore file" was created successfully. -An update for template package 'Microsoft.DotNet.Common.ItemTemplates::6.0.100' is available. +An update for template package 'Microsoft.DotNet.Common.ItemTemplates@6.0.100' is available. To update the package use: - dotnet new install Microsoft.DotNet.Common.ItemTemplates::%VERSION% + dotnet new install Microsoft.DotNet.Common.ItemTemplates@%VERSION% -An update for template package 'Microsoft.DotNet.Common.ItemTemplates::%VERSION%' is available in the '.NET SDK' provider. +An update for template package 'Microsoft.DotNet.Common.ItemTemplates@%VERSION%' is available in the '.NET SDK' provider. To use built-in template package, uninstall manually installed template package using: dotnet new uninstall Microsoft.DotNet.Common.ItemTemplates \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/DotnetNewInstallTests.Approval.cs b/test/dotnet-new.IntegrationTests/DotnetNewInstallTests.Approval.cs index f7911dc484a9..9b068c679759 100644 --- a/test/dotnet-new.IntegrationTests/DotnetNewInstallTests.Approval.cs +++ b/test/dotnet-new.IntegrationTests/DotnetNewInstallTests.Approval.cs @@ -22,7 +22,7 @@ public Task CannotInstallPackageAvailableFromBuiltIns() return Verify(commandResult.StdErr) .AddScrubber(output => { - output.ScrubByRegex(" Microsoft\\.DotNet\\.Common\\.ItemTemplates::[A-Za-z0-9.-]+", " Microsoft.DotNet.Common.ItemTemplates::%VERSION%"); + output.ScrubByRegex(" Microsoft\\.DotNet\\.Common\\.ItemTemplates@[A-Za-z0-9.-]+", " Microsoft.DotNet.Common.ItemTemplates@%VERSION%"); }); } @@ -41,7 +41,8 @@ public Task CanInstallPackageAvailableFromBuiltInsWithForce() return Verify(commandResult.StdOut) .AddScrubber(output => { - output.ScrubByRegex(" Microsoft.DotNet.Common.ItemTemplates::[A-Za-z0-9.-]+", " Microsoft.DotNet.Common.ItemTemplates::%VERSION%"); + output.ScrubByRegex(" Microsoft\\.DotNet\\.Common\\.ItemTemplates::[A-Za-z0-9.-]+", " Microsoft.DotNet.Common.ItemTemplates::%VERSION%"); + output.ScrubByRegex(" Microsoft\\.DotNet\\.Common\\.ItemTemplates@[A-Za-z0-9.-]+", " Microsoft.DotNet.Common.ItemTemplates@%VERSION%"); }); } @@ -60,7 +61,7 @@ public Task CannotInstallMultiplePackageAvailableFromBuiltIns() return Verify(commandResult.StdErr) .AddScrubber(output => { - output.ScrubByRegex(" Microsoft\\.DotNet\\.Common\\.ItemTemplates::[A-Za-z0-9.-]+", " Microsoft.DotNet.Common.ItemTemplates@%VERSION%"); + output.ScrubByRegex(" Microsoft\\.DotNet\\.Common\\.ItemTemplates@[A-Za-z0-9.-]+", " Microsoft.DotNet.Common.ItemTemplates@%VERSION%"); }); } diff --git a/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.Approval.cs b/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.Approval.cs index 4122766c2f1f..866a93af2825 100644 --- a/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.Approval.cs +++ b/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.Approval.cs @@ -512,8 +512,8 @@ public Task CanShowWarningIfPackageIsAvailableFromBuiltInSources() return Verify(commandResult.StdOut) .AddScrubber(output => { - output.ScrubByRegex("'Microsoft\\.DotNet\\.Common\\.ItemTemplates::[A-Za-z0-9.-]+' is available in", "'Microsoft.DotNet.Common.ItemTemplates::%VERSION%' is available in"); - output.ScrubByRegex("install Microsoft\\.DotNet\\.Common\\.ItemTemplates::[A-Za-z0-9.-]+", "install Microsoft.DotNet.Common.ItemTemplates::%VERSION%"); + output.ScrubByRegex("'Microsoft\\.DotNet\\.Common\\.ItemTemplates@[A-Za-z0-9.-]+' is available in", "'Microsoft.DotNet.Common.ItemTemplates@%VERSION%' is available in"); + output.ScrubByRegex("install Microsoft\\.DotNet\\.Common\\.ItemTemplates@[A-Za-z0-9.-]+", "install Microsoft.DotNet.Common.ItemTemplates@%VERSION%"); }); } diff --git a/test/dotnet-new.IntegrationTests/DotnetNewUpdateTests.cs b/test/dotnet-new.IntegrationTests/DotnetNewUpdateTests.cs index d69773a417eb..61eaf09f8815 100644 --- a/test/dotnet-new.IntegrationTests/DotnetNewUpdateTests.cs +++ b/test/dotnet-new.IntegrationTests/DotnetNewUpdateTests.cs @@ -43,8 +43,8 @@ public void CanCheckForUpdate(string testCase) .And.HaveStdOutMatching("Package\\s+Current\\s+Latest") .And.HaveStdOutMatching("Microsoft.DotNet.Common.ProjectTemplates.5.0\\s+5.0.0\\s+([\\d\\.a-z-])+") .And.HaveStdOutContaining("To update the package use:") - .And.HaveStdOutContaining(" dotnet new install ::") - .And.HaveStdOutMatching(" dotnet new install Microsoft\\.DotNet\\.Common\\.ProjectTemplates\\.5\\.0::([\\d\\.a-z-])+"); + .And.HaveStdOutContaining(" dotnet new install @") + .And.HaveStdOutMatching(" dotnet new install Microsoft\\.DotNet\\.Common\\.ProjectTemplates\\.5\\.0@([\\d\\.a-z-])+"); } [Fact] @@ -132,9 +132,9 @@ public void PrintInfoOnUpdateOnCreation() .And .NotHaveStdErr() .And.HaveStdOutContaining("The template \"Console Application\" was created successfully.") - .And.HaveStdOutContaining("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0::5.0.0' is available") + .And.HaveStdOutContaining("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0@5.0.0' is available") .And.HaveStdOutContaining("To update the package use:") - .And.HaveStdOutMatching(" dotnet new install Microsoft.DotNet.Common.ProjectTemplates.5.0::([\\d\\.a-z-])+"); + .And.HaveStdOutMatching(" dotnet new install Microsoft.DotNet.Common.ProjectTemplates.5.0@([\\d\\.a-z-])+"); } [Fact] @@ -162,9 +162,9 @@ public void DoesNotPrintUpdateInfoOnCreation_WhenNoUpdateCheckOption() .And .NotHaveStdErr() .And.HaveStdOutContaining("The template \"Console Application\" was created successfully.") - .And.NotHaveStdOutContaining("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0::5.0.0' is available") + .And.NotHaveStdOutContaining("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0@5.0.0' is available") .And.NotHaveStdOutContaining("To update the package use:") - .And.NotHaveStdOutContaining(" dotnet new --install Microsoft.DotNet.Common.ProjectTemplates.5.0::([\\d\\.a-z-])+"); + .And.NotHaveStdOutContaining(" dotnet new --install Microsoft.DotNet.Common.ProjectTemplates.5.0@([\\d\\.a-z-])+"); new DotnetNewCommand(_log, "console", "-o", "update-check") .WithCustomHive(home).WithoutBuiltInTemplates() @@ -175,9 +175,9 @@ public void DoesNotPrintUpdateInfoOnCreation_WhenNoUpdateCheckOption() .And .NotHaveStdErr() .And.HaveStdOutContaining("The template \"Console Application\" was created successfully.") - .And.HaveStdOutContaining("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0::5.0.0' is available") + .And.HaveStdOutContaining("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0@5.0.0' is available") .And.HaveStdOutContaining("To update the package use:") - .And.HaveStdOutMatching(" dotnet new install Microsoft.DotNet.Common.ProjectTemplates.5.0::([\\d\\.a-z-])+"); + .And.HaveStdOutMatching(" dotnet new install Microsoft.DotNet.Common.ProjectTemplates.5.0@([\\d\\.a-z-])+"); } [Fact] @@ -205,9 +205,9 @@ public void DoesNotPrintUpdateInfoOnCreation_WhenLatestVersionIsInstalled() .And .NotHaveStdErr() .And.HaveStdOutContaining("The template \"Console App\" was created successfully.") - .And.NotHaveStdOutMatching("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0::([\\d\\.a-z-])+' is available") + .And.NotHaveStdOutMatching("An update for template package 'Microsoft.DotNet.Common.ProjectTemplates.5.0@([\\d\\.a-z-])+' is available") .And.NotHaveStdOutContaining("To update the package use:") - .And.NotHaveStdOutMatching(" dotnet new install Microsoft.DotNet.Common.ProjectTemplates.5.0::([\\d\\.a-z-])+"); + .And.NotHaveStdOutMatching(" dotnet new install Microsoft.DotNet.Common.ProjectTemplates.5.0@([\\d\\.a-z-])+"); } [Fact] @@ -275,8 +275,8 @@ public void CanApplyUpdates(string testCase) .And.HaveStdOutMatching("Package\\s+Current\\s+Latest") .And.HaveStdOutMatching("Microsoft.DotNet.Common.ProjectTemplates.5.0\\s+5.0.0\\s+([\\d\\.a-z-])+") .And.HaveStdOutContaining("To update the package use:") - .And.HaveStdOutContaining(" dotnet new install ::") - .And.HaveStdOutMatching(" dotnet new install Microsoft\\.DotNet\\.Common\\.ProjectTemplates\\.5\\.0::([\\d\\.a-z-])+"); + .And.HaveStdOutContaining(" dotnet new install @") + .And.HaveStdOutMatching(" dotnet new install Microsoft\\.DotNet\\.Common\\.ProjectTemplates\\.5\\.0@([\\d\\.a-z-])+"); new DotnetNewCommand(_log, testCase) .WithCustomHive(home).WithoutBuiltInTemplates()