From bed5fb1a19b7b34140c2352206843d7c95311a9d Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 10:08:04 +0200 Subject: [PATCH 01/13] Add PostAction for dotnet.config --- .../Components.cs | 3 +- .../LocalizableStrings.Designer.cs | 84 +++++-- .../LocalizableStrings.resx | 15 ++ .../Microsoft.TemplateEngine.Cli.csproj | 1 + ...OrUpdateDotnetConfigPostActionProcessor.cs | 124 +++++++++++ .../xlf/LocalizableStrings.cs.xlf | 25 +++ .../xlf/LocalizableStrings.de.xlf | 25 +++ .../xlf/LocalizableStrings.es.xlf | 25 +++ .../xlf/LocalizableStrings.fr.xlf | 25 +++ .../xlf/LocalizableStrings.it.xlf | 25 +++ .../xlf/LocalizableStrings.ja.xlf | 25 +++ .../xlf/LocalizableStrings.ko.xlf | 25 +++ .../xlf/LocalizableStrings.pl.xlf | 25 +++ .../xlf/LocalizableStrings.pt-BR.xlf | 25 +++ .../xlf/LocalizableStrings.ru.xlf | 25 +++ .../xlf/LocalizableStrings.tr.xlf | 25 +++ .../xlf/LocalizableStrings.zh-Hans.xlf | 25 +++ .../xlf/LocalizableStrings.zh-Hant.xlf | 25 +++ ...eateOrUpdateDotnetConfigPostActionTests.cs | 208 ++++++++++++++++++ 19 files changed, 737 insertions(+), 23 deletions(-) create mode 100644 src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs create mode 100644 test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Components.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Components.cs index 57eb7b1d9347..34870595d00e 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/Components.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/Components.cs @@ -14,7 +14,8 @@ public static class Components (typeof(IPostActionProcessor), new ChmodPostActionProcessor()), (typeof(IPostActionProcessor), new InstructionDisplayPostActionProcessor()), (typeof(IPostActionProcessor), new ProcessStartPostActionProcessor()), - (typeof(IPostActionProcessor), new AddJsonPropertyPostActionProcessor()) + (typeof(IPostActionProcessor), new AddJsonPropertyPostActionProcessor()), + (typeof(IPostActionProcessor), new CreateOrUpdateDotnetConfigPostActionProcessor()), }; } } diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs index 18d737c820d9..06f5a9b5d134 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.TemplateEngine.Cli { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class LocalizableStrings { @@ -458,6 +458,15 @@ internal static string CliTemplateSearchCoordinator_Info_SearchInProgress { } } + /// + /// Looks up a localized string similar to The colon separator "::" has been deprecated in favor of the at symbol "@" for separating the package from the version in dotnet new install. In your case, this means {0}@{1} instead of {0}::{1}.. + /// + internal static string Colon_Separator_Deprecated { + get { + return ResourceManager.GetString("Colon_Separator_Deprecated", resourceCulture); + } + } + /// /// Looks up a localized string similar to Author. /// @@ -1394,6 +1403,51 @@ internal static string PossibleValuesHeader { } } + /// + /// Looks up a localized string similar to Created new section in 'dotnet.config' file. + /// + internal static string PostAction_CreateDotnetConfig_CreatedNewSection { + get { + return ResourceManager.GetString("PostAction_CreateDotnetConfig_CreatedNewSection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'.. + /// + internal static string PostAction_CreateDotnetConfig_ManuallyUpdate { + get { + return ResourceManager.GetString("PostAction_CreateDotnetConfig_ManuallyUpdate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully created 'dotnet.config' file.. + /// + internal static string PostAction_CreateDotnetConfig_Succeeded { + get { + return ResourceManager.GetString("PostAction_CreateDotnetConfig_Succeeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The required value in 'dotnet.config' is already set.. + /// + internal static string PostAction_CreateDotnetConfig_ValueAlreadyExist { + get { + return ResourceManager.GetString("PostAction_CreateDotnetConfig_ValueAlreadyExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Post action argument '{0}' is mandatory, but not configured.. + /// + internal static string PostAction_DotnetConfig_Error_ArgumentNotConfigured { + get { + return ResourceManager.GetString("PostAction_DotnetConfig_Error_ArgumentNotConfigured", resourceCulture); + } + } + /// /// Looks up a localized string similar to Post action argument '{0}' is not a valid boolean value.. /// @@ -1870,35 +1924,21 @@ internal static string TemplatePackageCoordinator_Install_Info_OverrideNotice { return ResourceManager.GetString("TemplatePackageCoordinator_Install_Info_OverrideNotice", resourceCulture); } } - - /// - /// Looks up a localized string similar to The following template packages will be installed:. - /// - internal static string TemplatePackageCoordinator_Install_Info_PackageIsAvailable - { - get - { - return ResourceManager.GetString("TemplatePackageCoordinator_Install_Info_PackageIsAvailable", resourceCulture); - } - } - + /// - /// Looks up a localized string indicating that :: as a separator is deprecated in favor of @. + /// Looks up a localized string similar to The following template package(s) are already available:. /// - internal static string Colon_Separator_Deprecated - { + internal static string TemplatePackageCoordinator_Install_Info_PackageIsAvailable { get { - return ResourceManager.GetString("Colon_Separator_Deprecated", resourceCulture); + return ResourceManager.GetString("TemplatePackageCoordinator_Install_Info_PackageIsAvailable", resourceCulture); } } - + /// /// Looks up a localized string similar to The following template packages will be installed:. /// - internal static string TemplatePackageCoordinator_Install_Info_PackagesToBeInstalled - { - get - { + internal static string TemplatePackageCoordinator_Install_Info_PackagesToBeInstalled { + get { return ResourceManager.GetString("TemplatePackageCoordinator_Install_Info_PackagesToBeInstalled", resourceCulture); } } diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx index 3f38783adb27..b3e552a12251 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx +++ b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx @@ -953,4 +953,19 @@ The header is followed by the list of parameters and their errors (might be seve Attempting to find json file '{0}' in '{1}' + + Post action argument '{0}' is mandatory, but not configured. + + + Successfully created 'dotnet.config' file. + + + Created new section in 'dotnet.config' file + + + The required value in 'dotnet.config' is already set. + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + \ No newline at end of file diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Microsoft.TemplateEngine.Cli.csproj b/src/Cli/Microsoft.TemplateEngine.Cli/Microsoft.TemplateEngine.Cli.csproj index 228c9cd613d2..d8fb3406268a 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/Microsoft.TemplateEngine.Cli.csproj +++ b/src/Cli/Microsoft.TemplateEngine.Cli/Microsoft.TemplateEngine.Cli.csproj @@ -16,6 +16,7 @@ + diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs new file mode 100644 index 000000000000..509da9fd1dde --- /dev/null +++ b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs @@ -0,0 +1,124 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.Cli.Utils; +using Microsoft.Extensions.Configuration; +using Microsoft.TemplateEngine.Abstractions; +using Microsoft.TemplateEngine.Abstractions.PhysicalFileSystem; + +namespace Microsoft.TemplateEngine.Cli.PostActionProcessors +{ + internal sealed class CreateOrUpdateDotnetConfigPostActionProcessor : PostActionProcessorBase + { + private const string SectionArgument = "section"; + private const string KeyArgument = "key"; + private const string ValueArgument = "value"; + + public override Guid Id => ActionProcessorId; + + internal static Guid ActionProcessorId { get; } = new Guid("597E7933-0D87-452C-B094-8FA0EEF7FD97"); + + protected override bool ProcessInternal( + IEngineEnvironmentSettings environment, + IPostAction action, + ICreationEffects creationEffects, + ICreationResult templateCreationResult, + string outputBasePath) + { + if (!action.Args.TryGetValue(SectionArgument, out string? sectionName)) + { + Reporter.Error.WriteLine(string.Format(LocalizableStrings.PostAction_DotnetConfig_Error_ArgumentNotConfigured, SectionArgument)); + return false; + } + + if (!action.Args.TryGetValue(KeyArgument, out string? key)) + { + Reporter.Error.WriteLine(string.Format(LocalizableStrings.PostAction_DotnetConfig_Error_ArgumentNotConfigured, KeyArgument)); + return false; + } + + if (!action.Args.TryGetValue(ValueArgument, out string? value)) + { + Reporter.Error.WriteLine(string.Format(LocalizableStrings.PostAction_DotnetConfig_Error_ArgumentNotConfigured, ValueArgument)); + return false; + } + + var fileSystem = environment.Host.FileSystem; + var repoRoot = GetRootDirectory(fileSystem, outputBasePath); + var dotnetConfigFilePath = Path.Combine(repoRoot, "dotnet.config"); + if (!fileSystem.FileExists(dotnetConfigFilePath)) + { + fileSystem.WriteAllText(dotnetConfigFilePath, $""" + [{sectionName}] + {key} = "{value}" + + """); + + Reporter.Output.WriteLine(LocalizableStrings.PostAction_CreateDotnetConfig_Succeeded); + return true; + } + + var builder = new ConfigurationBuilder(); + builder.AddIniFile(dotnetConfigFilePath); + IConfigurationRoot config = builder.Build(); + var section = config.GetSection(sectionName); + + if (!section.Exists()) + { + var existingContent = fileSystem.ReadAllText(dotnetConfigFilePath); + fileSystem.WriteAllText(dotnetConfigFilePath, $""" + {existingContent} + + [{sectionName}] + {key} = "{value}" + + """); + + Reporter.Output.WriteLine(LocalizableStrings.PostAction_CreateDotnetConfig_CreatedNewSection); + return true; + } + + string? existingValue = section[key]; + if (string.IsNullOrEmpty(existingValue)) + { + // The section exists, but the key/value pair does not. + Reporter.Output.WriteStdErr(string.Format(LocalizableStrings.PostAction_CreateDotnetConfig_ManuallyUpdate, $"{key} = \"{value}\"", $"[{sectionName}]")); + return false; + } + + if (existingValue.Equals(value, StringComparison.Ordinal)) + { + // The key already exists with the same value, nothing to do. + Reporter.Output.WriteLine(LocalizableStrings.PostAction_CreateDotnetConfig_ValueAlreadyExist); + return true; + } + + Reporter.Output.WriteStdErr(string.Format(LocalizableStrings.PostAction_CreateDotnetConfig_ManuallyUpdate, $"{key} = \"{value}\"", $"[{sectionName}]")); + return false; + } + + private static string GetRootDirectory(IPhysicalFileSystem fileSystem, string outputBasePath) + { + string? currentDirectory = outputBasePath; + string? directoryWithSln = null; + while (currentDirectory is not null) + { + if (fileSystem.FileExists(Path.Combine(currentDirectory, "dotnet.config")) || + fileSystem.DirectoryExists(Path.Combine(currentDirectory, ".git"))) + { + return currentDirectory; + } + + if (fileSystem.EnumerateFiles(currentDirectory, "*.sln", SearchOption.TopDirectoryOnly).Any() || + fileSystem.EnumerateFiles(currentDirectory, "*.slnx", SearchOption.TopDirectoryOnly).Any()) + { + directoryWithSln = currentDirectory; + } + + currentDirectory = Directory.GetParent(currentDirectory)?.FullName; + } + + return directoryWithSln ?? outputBasePath; + } + } +} diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf index 45f6d58a1ba7..0b5d604868ea 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Chcete tuto akci spustit? [{0}(ano)|{1}(ne)] + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. Argument post-action {0} není platná logická hodnota. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf index eb67ab8bf9bf..326736a919e8 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Möchten Sie diese Aktion ausführen [{0} (ja) |{1} (nein)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. Das Post-Aktionsargument „{0}“ ist kein gültiger boolescher Wert. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf index 748e66f30a00..bc4b33f5afeb 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve ¿Quiere ejecutar esta acción [{0}(yes)|{1}(no)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. El argumento de la acción publicado '{0}' no es un valor booleano válido. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf index d86722e36e60..f12d74055124 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Voulez-vous exécuter cette action [{0} (yes) |{1} (no)] ? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. L’argument post-action « {0} » n’est pas une valeur booléenne valide. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf index 45d8e4f02e4e..e8024348e5cb 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Eseguire questa azione [{0} (sì) |{1} (no)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. L'argomento dell'azione successiva '{0}' non è un valore booleano valido. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf index 2f9a5c77a259..e5432d2ede0e 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve このアクションを実行しますか[{0} (はい) |{1} (いいえ)] ですか? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. 事後アクションの引数 '{0}' は有効なブール値ではありません。 diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf index 11699454506d..5d685b2724b6 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve 이 작업을 실행하시겠어요 [{0} (예) |{1} (아니요)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. 사후 작업 인수 '{0}'은(는) 올바른 부울 값이 아닙니다. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf index 6e5167124b31..159ceabb8cbf 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Chcesz uruchomić tę akcję [{0}(tak)|{1}(nie)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. Argument akcji „{0}” nie jest prawidłową wartością logiczną. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf index 24f89179cb85..b8a11fe61e3f 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Deseja executar esta ação [{0}(yes)|{1}(no)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. O argumento de pós-ação '{0}' não é um valor booleano válido. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf index 6578a4d5bf14..6daa18fedc4e 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Вы хотите выполнить это действие [{0}(да)|{1}(нет)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. Аргумент после действия "{0}" не является допустимым логическим значением. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf index a0d71cff2b96..3410bdf4bceb 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve Bu eylemi çalıştırmak istiyor musunuz [{0}(evet)|{1}(hayır)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. '{0}' eylem sonrası bağımsız değişkeni, geçerli bir boole değeri değil. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf index f75d8ad68dae..f01135837319 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve 是否要运行此操作 [{0}(是)|{1}(否)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. Post 操作参数“{0}”不是有效的布尔值。 diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf index 56c64a9d9b91..f182e0a5579a 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf @@ -830,6 +830,31 @@ The header is followed by the list of parameters and their errors (might be seve 是否要執行此動作 [{0}(是)|{1}(否)]? + + Created new section in 'dotnet.config' file + Created new section in 'dotnet.config' file + + + + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + + + + Successfully created 'dotnet.config' file. + Successfully created 'dotnet.config' file. + + + + The required value in 'dotnet.config' is already set. + The required value in 'dotnet.config' is already set. + + + + Post action argument '{0}' is mandatory, but not configured. + Post action argument '{0}' is mandatory, but not configured. + + Post action argument '{0}' is not a valid boolean value. Post 巨集指令引數 '{0}' 不是有效的布林值。 diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs b/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs new file mode 100644 index 000000000000..86fdf5e82f1a --- /dev/null +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs @@ -0,0 +1,208 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.Cli.Utils; +using Microsoft.TemplateEngine.Abstractions; +using Microsoft.TemplateEngine.Cli.PostActionProcessors; +using Microsoft.TemplateEngine.Mocks; +using Microsoft.TemplateEngine.TestHelper; + +using Moq; + +namespace Microsoft.TemplateEngine.Cli.UnitTests.PostActionTests; + +public class CreateOrUpdateDotnetConfigPostActionTests : IClassFixture +{ + private readonly IEngineEnvironmentSettings _engineEnvironmentSettings; + + public CreateOrUpdateDotnetConfigPostActionTests(EnvironmentSettingsHelper environmentSettingsHelper) + { + _engineEnvironmentSettings = environmentSettingsHelper.CreateEnvironment(hostIdentifier: GetType().Name, virtualize: true); + } + + [Theory] + [InlineData("section")] + [InlineData("key")] + [InlineData("value")] + public void MissingArgumentShouldFail(string missingArgumentName) + { + string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + + var dictionary = new Dictionary + { + ["section"] = "dotnet.test.runner", + ["key"] = "name", + ["value"] = "Microsoft.Testing.Platform" + }; + dictionary.Remove(missingArgumentName); + + IPostAction postAction = new MockPostAction(default, default, default, default, default!) + { + ActionId = CreateOrUpdateDotnetConfigPostActionProcessor.ActionProcessorId, + Args = dictionary, + }; + + Mock mockReporter = new(); + + mockReporter.Setup(r => r.WriteLine(It.IsAny())) + .Verifiable(); + + Reporter.SetError(mockReporter.Object); + + CreateOrUpdateDotnetConfigPostActionProcessor processor = new(); + + bool result = processor.Process( + _engineEnvironmentSettings, + postAction, + new MockCreationEffects(), + new MockCreationResult(), + targetBasePath); + + Assert.False(result); + + mockReporter.Verify(r => r.WriteLine(string.Format(LocalizableStrings.PostAction_DotnetConfig_Error_ArgumentNotConfigured, missingArgumentName)), Times.Once); + } + + [Fact] + public void CreatesDotnetConfigWhenDoesNotExist() + { + string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + + IPostAction postAction = CreatePostActionForMTP(); + + Mock mockReporter = new(); + + mockReporter.Setup(r => r.WriteLine(It.IsAny())) + .Verifiable(); + + Reporter.SetOutput(mockReporter.Object); + + CreateOrUpdateDotnetConfigPostActionProcessor processor = new(); + + _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeFalse(); + + bool result = processor.Process( + _engineEnvironmentSettings, + postAction, + new MockCreationEffects(), + new MockCreationResult(), + targetBasePath); + + Assert.True(result); + + _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + [dotnet.test.runner] + name = "Microsoft.Testing.Platform" + + """); + + mockReporter.Verify(r => r.WriteLine(LocalizableStrings.PostAction_CreateDotnetConfig_Succeeded), Times.Once); + } + + [Fact] + public void CreatesNewSectionWhenFileExistsButSectionDoesNot() + { + string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + + IPostAction postAction = CreatePostActionForMTP(); + CreateDotnetConfig(targetBasePath, "mysection", "mykey", "myvalue"); + Mock mockReporter = new(); + + mockReporter.Setup(r => r.WriteLine(It.IsAny())) + .Verifiable(); + + Reporter.SetOutput(mockReporter.Object); + + CreateOrUpdateDotnetConfigPostActionProcessor processor = new(); + + _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + [mysection] + mykey = "myvalue" + + """); + + bool result = processor.Process( + _engineEnvironmentSettings, + postAction, + new MockCreationEffects(), + new MockCreationResult(), + targetBasePath); + + Assert.True(result); + + _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + [mysection] + mykey = "myvalue" + + [dotnet.test.runner] + name = "Microsoft.Testing.Platform" + + """); + + mockReporter.Verify(r => r.WriteLine(LocalizableStrings.PostAction_CreateDotnetConfig_CreatedNewSection), Times.Once); + } + + [Fact] + public void DoesNothingIfNoUpdatesNeedToHappen() + { + string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + + IPostAction postAction = CreatePostActionForMTP(); + CreateDotnetConfig(targetBasePath, "dotnet.test.runner", "name", "Microsoft.Testing.Platform"); + Mock mockReporter = new(); + + mockReporter.Setup(r => r.WriteLine(It.IsAny())) + .Verifiable(); + + Reporter.SetOutput(mockReporter.Object); + + CreateOrUpdateDotnetConfigPostActionProcessor processor = new(); + + _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + [dotnet.test.runner] + name = "Microsoft.Testing.Platform" + + """); + + bool result = processor.Process( + _engineEnvironmentSettings, + postAction, + new MockCreationEffects(), + new MockCreationResult(), + targetBasePath); + + Assert.True(result); + + _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + [dotnet.test.runner] + name = "Microsoft.Testing.Platform" + + """); + + mockReporter.Verify(r => r.WriteLine(LocalizableStrings.PostAction_CreateDotnetConfig_ValueAlreadyExist), Times.Once); + } + + private static IPostAction CreatePostActionForMTP() + => new MockPostAction(default, default, default, default, default!) + { + ActionId = CreateOrUpdateDotnetConfigPostActionProcessor.ActionProcessorId, + Args = new Dictionary + { + ["section"] = "dotnet.test.runner", + ["key"] = "name", + ["value"] = "Microsoft.Testing.Platform", + }, + }; + + private void CreateDotnetConfig(string targetBasePath, string section, string key, string value) + => _engineEnvironmentSettings.Host.FileSystem.WriteAllText(Path.Combine(targetBasePath, "dotnet.config"), $""" + [{section}] + {key} = "{value}" + + """); +} From a11ab1efa155a100c8c79030c4c1b4fc60e70f8e Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 12:00:05 +0200 Subject: [PATCH 02/13] Use stream --- .../CreateOrUpdateDotnetConfigPostActionProcessor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs index 509da9fd1dde..7b74b4022f89 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs @@ -59,7 +59,8 @@ protected override bool ProcessInternal( } var builder = new ConfigurationBuilder(); - builder.AddIniFile(dotnetConfigFilePath); + using var stream = fileSystem.OpenRead(dotnetConfigFilePath); + builder.AddIniStream(stream); IConfigurationRoot config = builder.Build(); var section = config.GetSection(sectionName); From 4fd4e432321195c443198f5ee9afcbf11c0e6a6c Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 12:49:51 +0200 Subject: [PATCH 03/13] Fix --- ...OrUpdateDotnetConfigPostActionProcessor.cs | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs index 7b74b4022f89..89d4f738a5af 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs @@ -110,8 +110,28 @@ private static string GetRootDirectory(IPhysicalFileSystem fileSystem, string ou return currentDirectory; } - if (fileSystem.EnumerateFiles(currentDirectory, "*.sln", SearchOption.TopDirectoryOnly).Any() || - fileSystem.EnumerateFiles(currentDirectory, "*.slnx", SearchOption.TopDirectoryOnly).Any()) + // DirectoryExists here should always be in practice, but for the way tests are mocking the file system, it's not. + // The check was added to prevent test failures similar to: + // System.IO.DirectoryNotFoundException : Could not find a part of the path '/Users/runner/work/1/s/artifacts/bin/Microsoft.TemplateEngine.Cli.UnitTests/Release/sandbox'. + // at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) + // at System.IO.Enumeration.FileSystemEnumerator`1.Init() + // at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) + // at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options) + // at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions enumerationOptions) + // at Microsoft.TemplateEngine.Utils.PhysicalFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption) + // at Microsoft.TemplateEngine.TestHelper.MonitoredFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption) + // at Microsoft.TemplateEngine.Utils.InMemoryFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption)+MoveNext() + // at Microsoft.TemplateEngine.Utils.InMemoryFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption)+MoveNext() + // at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) + // at Microsoft.TemplateEngine.Cli.PostActionProcessors.CreateOrUpdateDotnetConfigPostActionProcessor.GetRootDirectory(IPhysicalFileSystem fileSystem, String outputBasePath) in /_/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs:line 113 + // at Microsoft.TemplateEngine.Cli.PostActionProcessors.CreateOrUpdateDotnetConfigPostActionProcessor.ProcessInternal(IEngineEnvironmentSettings environment, IPostAction action, ICreationEffects creationEffects, ICreationResult templateCreationResult, String outputBasePath) in /_/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs:line 47 + // at Microsoft.TemplateEngine.Cli.PostActionProcessors.PostActionProcessorBase.Process(IEngineEnvironmentSettings environment, IPostAction action, ICreationEffects creationEffects, ICreationResult templateCreationResult, String outputBasePath) in /_/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/PostActionProcessorBase.cs:line 26 + // at Microsoft.TemplateEngine.Cli.UnitTests.PostActionTests.CreateOrUpdateDotnetConfigPostActionTests.CreatesDotnetConfigWhenDoesNotExist() in /Users/runner/work/1/s/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs:line 84 + // at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + // at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + if (fileSystem.DirectoryExists(currentDirectory) && + (fileSystem.EnumerateFiles(currentDirectory, "*.sln", SearchOption.TopDirectoryOnly).Any() || + fileSystem.EnumerateFiles(currentDirectory, "*.slnx", SearchOption.TopDirectoryOnly).Any())) { directoryWithSln = currentDirectory; } From 4bef01225f2634f4d586eac8f43706e8b1bb4ce5 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 13:49:19 +0200 Subject: [PATCH 04/13] Fix tests --- .../CreateOrUpdateDotnetConfigPostActionTests.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs b/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs index 86fdf5e82f1a..0a1bd35258f6 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.CompilerServices; using Microsoft.DotNet.Cli.Utils; using Microsoft.TemplateEngine.Abstractions; using Microsoft.TemplateEngine.Cli.PostActionProcessors; @@ -26,7 +27,7 @@ public CreateOrUpdateDotnetConfigPostActionTests(EnvironmentSettingsHelper envir [InlineData("value")] public void MissingArgumentShouldFail(string missingArgumentName) { - string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + string targetBasePath = GetTargetPath(); var dictionary = new Dictionary { @@ -66,7 +67,7 @@ public void MissingArgumentShouldFail(string missingArgumentName) [Fact] public void CreatesDotnetConfigWhenDoesNotExist() { - string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + string targetBasePath = GetTargetPath(); IPostAction postAction = CreatePostActionForMTP(); @@ -103,7 +104,7 @@ public void CreatesDotnetConfigWhenDoesNotExist() [Fact] public void CreatesNewSectionWhenFileExistsButSectionDoesNot() { - string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + string targetBasePath = GetTargetPath(); IPostAction postAction = CreatePostActionForMTP(); CreateDotnetConfig(targetBasePath, "mysection", "mykey", "myvalue"); @@ -148,7 +149,7 @@ public void CreatesNewSectionWhenFileExistsButSectionDoesNot() [Fact] public void DoesNothingIfNoUpdatesNeedToHappen() { - string targetBasePath = _engineEnvironmentSettings.GetTempVirtualizedPath(); + string targetBasePath = GetTargetPath(); IPostAction postAction = CreatePostActionForMTP(); CreateDotnetConfig(targetBasePath, "dotnet.test.runner", "name", "Microsoft.Testing.Platform"); @@ -205,4 +206,11 @@ private void CreateDotnetConfig(string targetBasePath, string section, string ke {key} = "{value}" """); + + private string GetTargetPath([CallerMemberName] string testName = "") + { + string targetBasePath = Path.Combine(_engineEnvironmentSettings.GetTempVirtualizedPath(), testName); + _engineEnvironmentSettings.Host.FileSystem.CreateDirectory(targetBasePath); + return targetBasePath; + } } From c5f972c5f1d4d77a02a5c22921af96f5105bd417 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 20 Aug 2025 07:53:14 +0200 Subject: [PATCH 05/13] Fix tests --- ...eateOrUpdateDotnetConfigPostActionTests.cs | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs b/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs index 0a1bd35258f6..6d66a0c6b895 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs @@ -68,6 +68,7 @@ public void MissingArgumentShouldFail(string missingArgumentName) public void CreatesDotnetConfigWhenDoesNotExist() { string targetBasePath = GetTargetPath(); + string dotnetConfigPath = Path.Combine(targetBasePath, "dotnet.config"); IPostAction postAction = CreatePostActionForMTP(); @@ -80,7 +81,7 @@ public void CreatesDotnetConfigWhenDoesNotExist() CreateOrUpdateDotnetConfigPostActionProcessor processor = new(); - _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeFalse(); + _engineEnvironmentSettings.Host.FileSystem.FileExists(dotnetConfigPath).Should().BeFalse(); bool result = processor.Process( _engineEnvironmentSettings, @@ -91,8 +92,8 @@ public void CreatesDotnetConfigWhenDoesNotExist() Assert.True(result); - _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); - _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + _engineEnvironmentSettings.Host.FileSystem.FileExists(dotnetConfigPath).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(dotnetConfigPath).Should().Be(""" [dotnet.test.runner] name = "Microsoft.Testing.Platform" @@ -105,9 +106,10 @@ public void CreatesDotnetConfigWhenDoesNotExist() public void CreatesNewSectionWhenFileExistsButSectionDoesNot() { string targetBasePath = GetTargetPath(); + string dotnetConfigPath = Path.Combine(targetBasePath, "dotnet.config"); IPostAction postAction = CreatePostActionForMTP(); - CreateDotnetConfig(targetBasePath, "mysection", "mykey", "myvalue"); + CreateDotnetConfig(dotnetConfigPath, "mysection", "mykey", "myvalue"); Mock mockReporter = new(); mockReporter.Setup(r => r.WriteLine(It.IsAny())) @@ -117,8 +119,8 @@ public void CreatesNewSectionWhenFileExistsButSectionDoesNot() CreateOrUpdateDotnetConfigPostActionProcessor processor = new(); - _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); - _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + _engineEnvironmentSettings.Host.FileSystem.FileExists(dotnetConfigPath).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(dotnetConfigPath).Should().Be(""" [mysection] mykey = "myvalue" @@ -133,11 +135,12 @@ public void CreatesNewSectionWhenFileExistsButSectionDoesNot() Assert.True(result); - _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); - _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + _engineEnvironmentSettings.Host.FileSystem.FileExists(dotnetConfigPath).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(dotnetConfigPath).Should().Be(""" [mysection] mykey = "myvalue" + [dotnet.test.runner] name = "Microsoft.Testing.Platform" @@ -150,9 +153,10 @@ public void CreatesNewSectionWhenFileExistsButSectionDoesNot() public void DoesNothingIfNoUpdatesNeedToHappen() { string targetBasePath = GetTargetPath(); + string dotnetConfigPath = Path.Combine(targetBasePath, "dotnet.config"); IPostAction postAction = CreatePostActionForMTP(); - CreateDotnetConfig(targetBasePath, "dotnet.test.runner", "name", "Microsoft.Testing.Platform"); + CreateDotnetConfig(dotnetConfigPath, "dotnet.test.runner", "name", "Microsoft.Testing.Platform"); Mock mockReporter = new(); mockReporter.Setup(r => r.WriteLine(It.IsAny())) @@ -162,8 +166,8 @@ public void DoesNothingIfNoUpdatesNeedToHappen() CreateOrUpdateDotnetConfigPostActionProcessor processor = new(); - _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); - _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + _engineEnvironmentSettings.Host.FileSystem.FileExists(dotnetConfigPath).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(dotnetConfigPath).Should().Be(""" [dotnet.test.runner] name = "Microsoft.Testing.Platform" @@ -178,8 +182,8 @@ public void DoesNothingIfNoUpdatesNeedToHappen() Assert.True(result); - _engineEnvironmentSettings.Host.FileSystem.FileExists(Path.Combine(targetBasePath, "dotnet.config")).Should().BeTrue(); - _engineEnvironmentSettings.Host.FileSystem.ReadAllText(Path.Combine(targetBasePath, "dotnet.config")).Should().Be(""" + _engineEnvironmentSettings.Host.FileSystem.FileExists(dotnetConfigPath).Should().BeTrue(); + _engineEnvironmentSettings.Host.FileSystem.ReadAllText(dotnetConfigPath).Should().Be(""" [dotnet.test.runner] name = "Microsoft.Testing.Platform" @@ -200,8 +204,8 @@ private static IPostAction CreatePostActionForMTP() }, }; - private void CreateDotnetConfig(string targetBasePath, string section, string key, string value) - => _engineEnvironmentSettings.Host.FileSystem.WriteAllText(Path.Combine(targetBasePath, "dotnet.config"), $""" + private void CreateDotnetConfig(string dotnetConfigPath, string section, string key, string value) + => _engineEnvironmentSettings.Host.FileSystem.WriteAllText(dotnetConfigPath, $""" [{section}] {key} = "{value}" @@ -211,6 +215,9 @@ private string GetTargetPath([CallerMemberName] string testName = "") { string targetBasePath = Path.Combine(_engineEnvironmentSettings.GetTempVirtualizedPath(), testName); _engineEnvironmentSettings.Host.FileSystem.CreateDirectory(targetBasePath); + + // This is done to not let the preprocessor logic go above our base path directory. + _engineEnvironmentSettings.Host.FileSystem.CreateDirectory(Path.Combine(targetBasePath, ".git")); return targetBasePath; } } From 86b01781268105ec045e021c251c8759c99e7df6 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 20 Aug 2025 08:07:05 +0200 Subject: [PATCH 06/13] Address Copilot comments --- .../LocalizableStrings.Designer.cs | 2 +- src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx | 2 +- .../CreateOrUpdateDotnetConfigPostActionProcessor.cs | 4 ++-- .../xlf/LocalizableStrings.cs.xlf | 4 ++-- .../xlf/LocalizableStrings.de.xlf | 4 ++-- .../xlf/LocalizableStrings.es.xlf | 4 ++-- .../xlf/LocalizableStrings.fr.xlf | 4 ++-- .../xlf/LocalizableStrings.it.xlf | 4 ++-- .../xlf/LocalizableStrings.ja.xlf | 4 ++-- .../xlf/LocalizableStrings.ko.xlf | 4 ++-- .../xlf/LocalizableStrings.pl.xlf | 4 ++-- .../xlf/LocalizableStrings.pt-BR.xlf | 4 ++-- .../xlf/LocalizableStrings.ru.xlf | 4 ++-- .../xlf/LocalizableStrings.tr.xlf | 4 ++-- .../xlf/LocalizableStrings.zh-Hans.xlf | 4 ++-- .../xlf/LocalizableStrings.zh-Hant.xlf | 4 ++-- 16 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs index 06f5a9b5d134..f7b0a86e0e80 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs @@ -1413,7 +1413,7 @@ internal static string PostAction_CreateDotnetConfig_CreatedNewSection { } /// - /// Looks up a localized string similar to Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'.. + /// Looks up a localized string similar to Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'.. /// internal static string PostAction_CreateDotnetConfig_ManuallyUpdate { get { diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx index b3e552a12251..476c14cedde4 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx +++ b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx @@ -966,6 +966,6 @@ The header is followed by the list of parameters and their errors (might be seve The required value in 'dotnet.config' is already set. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. \ No newline at end of file diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs index 89d4f738a5af..77318a0b9989 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs @@ -83,7 +83,7 @@ protected override bool ProcessInternal( if (string.IsNullOrEmpty(existingValue)) { // The section exists, but the key/value pair does not. - Reporter.Output.WriteStdErr(string.Format(LocalizableStrings.PostAction_CreateDotnetConfig_ManuallyUpdate, $"{key} = \"{value}\"", $"[{sectionName}]")); + Reporter.Error.WriteLine(string.Format(LocalizableStrings.PostAction_CreateDotnetConfig_ManuallyUpdate, $"{key} = \"{value}\"", $"[{sectionName}]")); return false; } @@ -94,7 +94,7 @@ protected override bool ProcessInternal( return true; } - Reporter.Output.WriteStdErr(string.Format(LocalizableStrings.PostAction_CreateDotnetConfig_ManuallyUpdate, $"{key} = \"{value}\"", $"[{sectionName}]")); + Reporter.Error.WriteLine(string.Format(LocalizableStrings.PostAction_CreateDotnetConfig_ManuallyUpdate, $"{key} = \"{value}\"", $"[{sectionName}]")); return false; } diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf index 0b5d604868ea..48be0c4e65cc 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf index 326736a919e8..298dd4251790 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf index bc4b33f5afeb..a5885352b97e 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf index f12d74055124..d05c197f9b7a 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf index e8024348e5cb..3aa2e7e8b4fc 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf index e5432d2ede0e..701abbf68786 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf index 5d685b2724b6..4e1fb59c5d12 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf index 159ceabb8cbf..61bda6a320f5 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf index b8a11fe61e3f..5bac5e7e2403 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf index 6daa18fedc4e..f54f07bd794a 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf index 3410bdf4bceb..2a9b7f4c7ac0 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf index f01135837319..cde38824fa10 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf index f182e0a5579a..9ef605c7715c 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf @@ -836,8 +836,8 @@ The header is followed by the list of parameters and their errors (might be seve - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - Updating existing in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. From e74b3df25c1b65c28b0e116c5cd26970b0bc0982 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Wed, 20 Aug 2025 09:30:10 +0200 Subject: [PATCH 07/13] Update src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs --- .../CreateOrUpdateDotnetConfigPostActionProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs index 77318a0b9989..98c8748a45b2 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs @@ -110,7 +110,7 @@ private static string GetRootDirectory(IPhysicalFileSystem fileSystem, string ou return currentDirectory; } - // DirectoryExists here should always be in practice, but for the way tests are mocking the file system, it's not. + // DirectoryExists here should always be true in practice, but for the way tests are mocking the file system, it's not. // The check was added to prevent test failures similar to: // System.IO.DirectoryNotFoundException : Could not find a part of the path '/Users/runner/work/1/s/artifacts/bin/Microsoft.TemplateEngine.Cli.UnitTests/Release/sandbox'. // at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) From 128c9cd0014fdf64942337793ae98d78307042f8 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Wed, 20 Aug 2025 09:35:03 +0200 Subject: [PATCH 08/13] Reduce noise --- ...eOrUpdateDotnetConfigPostActionProcessor.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs index 98c8748a45b2..9afbf5e899a0 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs @@ -113,22 +113,8 @@ private static string GetRootDirectory(IPhysicalFileSystem fileSystem, string ou // DirectoryExists here should always be true in practice, but for the way tests are mocking the file system, it's not. // The check was added to prevent test failures similar to: // System.IO.DirectoryNotFoundException : Could not find a part of the path '/Users/runner/work/1/s/artifacts/bin/Microsoft.TemplateEngine.Cli.UnitTests/Release/sandbox'. - // at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) - // at System.IO.Enumeration.FileSystemEnumerator`1.Init() - // at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) - // at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options) - // at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions enumerationOptions) - // at Microsoft.TemplateEngine.Utils.PhysicalFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption) - // at Microsoft.TemplateEngine.TestHelper.MonitoredFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption) - // at Microsoft.TemplateEngine.Utils.InMemoryFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption)+MoveNext() - // at Microsoft.TemplateEngine.Utils.InMemoryFileSystem.EnumerateFiles(String path, String pattern, SearchOption searchOption)+MoveNext() - // at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) - // at Microsoft.TemplateEngine.Cli.PostActionProcessors.CreateOrUpdateDotnetConfigPostActionProcessor.GetRootDirectory(IPhysicalFileSystem fileSystem, String outputBasePath) in /_/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs:line 113 - // at Microsoft.TemplateEngine.Cli.PostActionProcessors.CreateOrUpdateDotnetConfigPostActionProcessor.ProcessInternal(IEngineEnvironmentSettings environment, IPostAction action, ICreationEffects creationEffects, ICreationResult templateCreationResult, String outputBasePath) in /_/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs:line 47 - // at Microsoft.TemplateEngine.Cli.PostActionProcessors.PostActionProcessorBase.Process(IEngineEnvironmentSettings environment, IPostAction action, ICreationEffects creationEffects, ICreationResult templateCreationResult, String outputBasePath) in /_/src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/PostActionProcessorBase.cs:line 26 - // at Microsoft.TemplateEngine.Cli.UnitTests.PostActionTests.CreateOrUpdateDotnetConfigPostActionTests.CreatesDotnetConfigWhenDoesNotExist() in /Users/runner/work/1/s/test/Microsoft.TemplateEngine.Cli.UnitTests/PostActionTests/CreateOrUpdateDotnetConfigPostActionTests.cs:line 84 - // at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) - // at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + // We get to this exception when doing `EnumerateFiles` on a directory that was virtually created in memory (not really available on disk). + // EnumerateFiles tries to access the physical file system, which then fails. if (fileSystem.DirectoryExists(currentDirectory) && (fileSystem.EnumerateFiles(currentDirectory, "*.sln", SearchOption.TopDirectoryOnly).Any() || fileSystem.EnumerateFiles(currentDirectory, "*.slnx", SearchOption.TopDirectoryOnly).Any())) From 1e491cd405d8b96967bcfda3aba4d8c0c5f86b3c Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 21 Aug 2025 18:52:12 +0200 Subject: [PATCH 09/13] Update src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx Co-authored-by: Jacques Eloff --- src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx index 476c14cedde4..d7de5f7d82b2 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx +++ b/src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx @@ -958,14 +958,18 @@ The header is followed by the list of parameters and their errors (might be seve Successfully created 'dotnet.config' file. + {Locked="dotnet.config"} Created new section in 'dotnet.config' file + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. + {Locked="dotnet.config"} \ No newline at end of file From a1ee32bdc919ed6e63d886889d516570bfd48629 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 21 Aug 2025 20:13:39 +0200 Subject: [PATCH 10/13] Update xlf --- .../xlf/LocalizableStrings.cs.xlf | 8 ++++---- .../xlf/LocalizableStrings.de.xlf | 8 ++++---- .../xlf/LocalizableStrings.es.xlf | 8 ++++---- .../xlf/LocalizableStrings.fr.xlf | 8 ++++---- .../xlf/LocalizableStrings.it.xlf | 8 ++++---- .../xlf/LocalizableStrings.ja.xlf | 8 ++++---- .../xlf/LocalizableStrings.ko.xlf | 8 ++++---- .../xlf/LocalizableStrings.pl.xlf | 8 ++++---- .../xlf/LocalizableStrings.pt-BR.xlf | 8 ++++---- .../xlf/LocalizableStrings.ru.xlf | 8 ++++---- .../xlf/LocalizableStrings.tr.xlf | 8 ++++---- .../xlf/LocalizableStrings.zh-Hans.xlf | 8 ++++---- .../xlf/LocalizableStrings.zh-Hant.xlf | 8 ++++---- 13 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf index 48be0c4e65cc..2a4a247003b1 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf index 298dd4251790..2bf7017b7241 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf index a5885352b97e..5b9822e43d7b 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf index d05c197f9b7a..b25d0abe8451 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf index 3aa2e7e8b4fc..2d8e48dbaf41 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf index 701abbf68786..8c189ad07d9f 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf index 4e1fb59c5d12..01d53932780b 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf index 61bda6a320f5..e35d2f20dcfa 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf index 5bac5e7e2403..5f09b05a889f 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf index f54f07bd794a..e16f4f2f2508 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf index 2a9b7f4c7ac0..9cf57a18b1ff 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf index cde38824fa10..be2844f845b7 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf index 9ef605c7715c..df84bc90c6dd 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf @@ -833,22 +833,22 @@ The header is followed by the list of parameters and their errors (might be seve Created new section in 'dotnet.config' file Created new section in 'dotnet.config' file - + {Locked="dotnet.config"} Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. Updating existing values in 'dotnet.config' is not yet supported. Please, manually update 'dotnet.config' to have '{0}' under section '{1}'. - + {Locked="dotnet.config"} Successfully created 'dotnet.config' file. Successfully created 'dotnet.config' file. - + {Locked="dotnet.config"} The required value in 'dotnet.config' is already set. The required value in 'dotnet.config' is already set. - + {Locked="dotnet.config"} Post action argument '{0}' is mandatory, but not configured. From 0c27bcc5101d4508697db36a6cf11ef39d71b1aa Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 22 Aug 2025 13:22:22 +0200 Subject: [PATCH 11/13] Add more tests --- .../.template.config/template.json | 29 ++++++++ .../AddNewSection/AddNewSection.csproj | 8 +++ .../AddNewSection/Program.cs | 14 ++++ .../AddNewSection/dotnet.config | 2 + .../.template.config/template.json | 29 ++++++++ .../CreateNonExisting.csproj | 8 +++ .../CreateNonExisting/Program.cs | 14 ++++ .../PostActionTests.cs | 68 +++++++++++++++++++ 8 files changed, 172 insertions(+) create mode 100644 test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json create mode 100644 test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/AddNewSection.csproj create mode 100644 test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/Program.cs create mode 100644 test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/dotnet.config create mode 100644 test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json create mode 100644 test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/CreateNonExisting.csproj create mode 100644 test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/Program.cs diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json new file mode 100644 index 000000000000..d21521a260ff --- /dev/null +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json @@ -0,0 +1,29 @@ +{ + "author": "Test Asset", + "classifications": [ "Test Asset" ], + "name": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection", + "generatorVersions": "[1.0.0.0-*)", + "groupIdentity": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection", + "precedence": "100", + "identity": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection", + "shortName": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection", + "sourceName": "AddNewSection", + "primaryOutputs": [ + { + "path": "AddNewSection.csproj" + } + ], + "postActions": [ + { + "description": "Add dotnet.config", + "manualInstructions": [ { "text": "Create dotnet.config manually." } ], + "args": { + "section": "dotnet.test.runner", + "key": "name", + "value": "Microsoft.Testing.Platform" + }, + "actionId": "597E7933-0D87-452C-B094-8FA0EEF7FD97", + "continueOnError": true + } + ] +} diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/AddNewSection.csproj b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/AddNewSection.csproj new file mode 100644 index 000000000000..ba7e2d463888 --- /dev/null +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/AddNewSection.csproj @@ -0,0 +1,8 @@ + + + + Exe + $(CurrentTargetFramework) + + + diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/Program.cs b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/Program.cs new file mode 100644 index 000000000000..38a7692a4297 --- /dev/null +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/Program.cs @@ -0,0 +1,14 @@ +using System; +using Newtonsoft.Json; + +namespace Basic +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + string result = JsonConvert.SerializeObject(new { a = "test" }); + } + } +} diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/dotnet.config b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/dotnet.config new file mode 100644 index 000000000000..d658b6c3fdd3 --- /dev/null +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/dotnet.config @@ -0,0 +1,2 @@ +[existing-section] +mykey = "myvalue" \ No newline at end of file diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json new file mode 100644 index 000000000000..3dd67fd868b6 --- /dev/null +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json @@ -0,0 +1,29 @@ +{ + "author": "Test Asset", + "classifications": [ "Test Asset" ], + "name": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting", + "generatorVersions": "[1.0.0.0-*)", + "groupIdentity": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting", + "precedence": "100", + "identity": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting", + "shortName": "TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting", + "sourceName": "CreateNonExisting", + "primaryOutputs": [ + { + "path": "CreateNonExisting.csproj" + } + ], + "postActions": [ + { + "description": "Add dotnet.config", + "manualInstructions": [ { "text": "Create dotnet.config manually." } ], + "args": { + "section": "dotnet.test.runner", + "key": "name", + "value": "Microsoft.Testing.Platform" + }, + "actionId": "597E7933-0D87-452C-B094-8FA0EEF7FD97", + "continueOnError": true + } + ] +} diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/CreateNonExisting.csproj b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/CreateNonExisting.csproj new file mode 100644 index 000000000000..ba7e2d463888 --- /dev/null +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/CreateNonExisting.csproj @@ -0,0 +1,8 @@ + + + + Exe + $(CurrentTargetFramework) + + + diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/Program.cs b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/Program.cs new file mode 100644 index 000000000000..38a7692a4297 --- /dev/null +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/Program.cs @@ -0,0 +1,14 @@ +using System; +using Newtonsoft.Json; + +namespace Basic +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + string result = JsonConvert.SerializeObject(new { a = "test" }); + } + } +} diff --git a/test/dotnet-new.IntegrationTests/PostActionTests.cs b/test/dotnet-new.IntegrationTests/PostActionTests.cs index 3e9c6a391914..37a2bc1bd1cf 100644 --- a/test/dotnet-new.IntegrationTests/PostActionTests.cs +++ b/test/dotnet-new.IntegrationTests/PostActionTests.cs @@ -3,6 +3,7 @@ using System.Text.Json.Nodes; using Microsoft.DotNet.Cli.Utils; +using Microsoft.TemplateEngine.TestHelper; using Microsoft.TemplateEngine.Utils; namespace Microsoft.DotNet.Cli.New.IntegrationTests @@ -1215,5 +1216,72 @@ public void AddJsonProperty_FailsWhenJsonFileNotFoundInEligableDirectories() File.Delete(jsonFileLocation); } + + [Fact] + public void CreateOrUpdateDotnetConfig_CreateNonExisting() + { + string templateLocation = _testAssetsManager.CopyTestAsset("PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting", testAssetSubdirectory: DotnetNewTestTemplatesBasePath).WithSource().Path; + string expectedTemplateName = "TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting"; + string home = CreateTemporaryFolder(folderName: "Home"); + string workingDirectory = CreateTemporaryFolder(); + string outputDirectory = TestUtils.CreateTemporaryFolder(); + InstallTestTemplate(templateLocation, _log, home, workingDirectory); + + var commandResult = new DotnetNewCommand(_log, expectedTemplateName, "-n", "MyProject", "-o", outputDirectory) + .WithCustomHive(home) + .WithWorkingDirectory(workingDirectory) + .Execute(); + + commandResult + .Should() + .ExitWith(0) + .And.NotHaveStdErr() + .And.HaveStdOutContaining($"The template \"{expectedTemplateName}\" was created successfully.") + .And.HaveStdOutContaining("Successfully created 'dotnet.config' file.") + .And.NotHaveStdOutContaining("Manual instructions"); + + Assert.Equal( + """ + [dotnet.test.runner] + name = "Microsoft.Testing.Platform" + + """, + File.ReadAllText(Path.Combine(outputDirectory, "dotnet.config"))); + } + + [Fact] + public void CreateOrUpdateDotnetConfig_AddNewSection() + { + string templateLocation = _testAssetsManager.CopyTestAsset("PostActions/CreateOrUpdateDotnetConfig/AddNewSection", testAssetSubdirectory: DotnetNewTestTemplatesBasePath).WithSource().Path; + string expectedTemplateName = "TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection"; + string home = CreateTemporaryFolder(folderName: "Home"); + string workingDirectory = CreateTemporaryFolder(); + string outputDirectory = TestUtils.CreateTemporaryFolder(); + InstallTestTemplate(templateLocation, _log, home, workingDirectory); + + var commandResult = new DotnetNewCommand(_log, expectedTemplateName, "-n", "MyProject", "-o", outputDirectory) + .WithCustomHive(home) + .WithWorkingDirectory(workingDirectory) + .Execute(); + + commandResult + .Should() + .ExitWith(0) + .And.NotHaveStdErr() + .And.HaveStdOutContaining($"The template \"{expectedTemplateName}\" was created successfully.") + .And.HaveStdOutContaining("Created new section in 'dotnet.config' file") + .And.NotHaveStdOutContaining("Manual instructions"); + + Assert.Equal( + """ + [existing-section] + mykey = "myvalue" + + [dotnet.test.runner] + name = "Microsoft.Testing.Platform" + + """, + File.ReadAllText(Path.Combine(outputDirectory, "dotnet.config"))); + } } } From 23adb96c43e65f6fda0026de0038ce551068ae57 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 22 Aug 2025 14:33:23 +0200 Subject: [PATCH 12/13] Refactor tests to be not specific to MTP --- .../AddNewSection/.template.config/template.json | 6 +++--- .../CreateNonExisting/.template.config/template.json | 6 +++--- test/dotnet-new.IntegrationTests/PostActionTests.cs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json index d21521a260ff..18b058625a93 100644 --- a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/AddNewSection/.template.config/template.json @@ -18,9 +18,9 @@ "description": "Add dotnet.config", "manualInstructions": [ { "text": "Create dotnet.config manually." } ], "args": { - "section": "dotnet.test.runner", - "key": "name", - "value": "Microsoft.Testing.Platform" + "section": "SectionFromTemplateJson", + "key": "KeyFromTemplateJson", + "value": "ValueFromTemplateJson" }, "actionId": "597E7933-0D87-452C-B094-8FA0EEF7FD97", "continueOnError": true diff --git a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json index 3dd67fd868b6..93c23963f8d7 100644 --- a/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json +++ b/test/TestAssets/TestPackages/dotnet-new/test_templates/PostActions/CreateOrUpdateDotnetConfig/CreateNonExisting/.template.config/template.json @@ -18,9 +18,9 @@ "description": "Add dotnet.config", "manualInstructions": [ { "text": "Create dotnet.config manually." } ], "args": { - "section": "dotnet.test.runner", - "key": "name", - "value": "Microsoft.Testing.Platform" + "section": "SectionFromTemplateJson", + "key": "KeyFromTemplateJson", + "value": "ValueFromTemplateJson" }, "actionId": "597E7933-0D87-452C-B094-8FA0EEF7FD97", "continueOnError": true diff --git a/test/dotnet-new.IntegrationTests/PostActionTests.cs b/test/dotnet-new.IntegrationTests/PostActionTests.cs index 37a2bc1bd1cf..3acada973357 100644 --- a/test/dotnet-new.IntegrationTests/PostActionTests.cs +++ b/test/dotnet-new.IntegrationTests/PostActionTests.cs @@ -1242,8 +1242,8 @@ public void CreateOrUpdateDotnetConfig_CreateNonExisting() Assert.Equal( """ - [dotnet.test.runner] - name = "Microsoft.Testing.Platform" + [SectionFromTemplateJson] + KeyFromTemplateJson = "ValueFromTemplateJson" """, File.ReadAllText(Path.Combine(outputDirectory, "dotnet.config"))); @@ -1277,8 +1277,8 @@ public void CreateOrUpdateDotnetConfig_AddNewSection() [existing-section] mykey = "myvalue" - [dotnet.test.runner] - name = "Microsoft.Testing.Platform" + [SectionFromTemplateJson] + KeyFromTemplateJson = "ValueFromTemplateJson" """, File.ReadAllText(Path.Combine(outputDirectory, "dotnet.config"))); From 30f995dd1834309a70e4a78db5e0c3dc882b1aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 22 Aug 2025 19:02:14 +0200 Subject: [PATCH 13/13] Fix template tests --- ...playDetails_InstalledPackage_LocalPackage.Linux.verified.txt | 2 ++ ...isplayDetails_InstalledPackage_LocalPackage.OSX.verified.txt | 2 ++ ...ayDetails_InstalledPackage_LocalPackage.Windows.verified.txt | 2 ++ ...CanDisplayDetails_InstalledPackage_LocalPackage.verified.txt | 2 ++ 4 files changed, 8 insertions(+) diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Linux.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Linux.verified.txt index 948efa0f8d7b..c69514a6ee7b 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Linux.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Linux.verified.txt @@ -31,6 +31,8 @@ TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicInSolutionRoot Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithFiles Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithIndexes Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting Test Asset TestAssets.PostActions.Instructions.Basic TestAssets.PostActions.Instructions.Basic Test Asset TestAssets.PostActions.RestoreNuGet.Basic TestAssets.PostActions.RestoreNuGet.Basic Test Asset TestAssets.PostActions.RestoreNuGet.BasicWit... TestAssets.PostActions.RestoreNuGet.BasicWithFiles Test Asset diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.OSX.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.OSX.verified.txt index 948efa0f8d7b..c69514a6ee7b 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.OSX.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.OSX.verified.txt @@ -31,6 +31,8 @@ TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicInSolutionRoot Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithFiles Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithIndexes Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting Test Asset TestAssets.PostActions.Instructions.Basic TestAssets.PostActions.Instructions.Basic Test Asset TestAssets.PostActions.RestoreNuGet.Basic TestAssets.PostActions.RestoreNuGet.Basic Test Asset TestAssets.PostActions.RestoreNuGet.BasicWit... TestAssets.PostActions.RestoreNuGet.BasicWithFiles Test Asset diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Windows.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Windows.verified.txt index 8f48b106823e..f2c16d05d10d 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Windows.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.Windows.verified.txt @@ -31,6 +31,8 @@ TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithFiles Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithIndexes Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.Basic Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting Test Asset TestAssets.PostActions.Instructions.Basic TestAssets.PostActions.Instructions.Basic Test Asset TestAssets.PostActions.RestoreNuGet.BasicWit... TestAssets.PostActions.RestoreNuGet.BasicWithFiles Test Asset TestAssets.PostActions.RestoreNuGet.Basic TestAssets.PostActions.RestoreNuGet.Basic Test Asset diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.verified.txt index 3264f4ecfdd7..0a6b5d625e43 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_LocalPackage.verified.txt @@ -31,6 +31,8 @@ TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithFiles Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.BasicWithIndexes Test Asset TestAssets.PostActions.AddProjectToSolution.... TestAssets.PostActions.AddProjectToSolution.Basic Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.AddNewSection Test Asset + TestAssets.PostActions.CreateOrUpdateDotnetC... TestAssets.PostActions.CreateOrUpdateDotnetConfig.CreateNonExisting Test Asset TestAssets.PostActions.Instructions.Basic TestAssets.PostActions.Instructions.Basic Test Asset TestAssets.PostActions.RestoreNuGet.BasicWit... TestAssets.PostActions.RestoreNuGet.BasicWithFiles Test Asset TestAssets.PostActions.RestoreNuGet.Basic TestAssets.PostActions.RestoreNuGet.Basic Test Asset