From b344815a36441dae0e448d2c737d6aa8c8d156a8 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 10:08:04 +0200 Subject: [PATCH 1/6] 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 48395abc3a0c7a3a6969613b39e928911d12dc48 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 12:00:05 +0200 Subject: [PATCH 2/6] 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 926a67e4cef993763e42388e4c8fe74bf1f8cb12 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 12:49:51 +0200 Subject: [PATCH 3/6] 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 2f616c86e00e8bd64007dbb30bf468df424d822a Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 13:49:19 +0200 Subject: [PATCH 4/6] 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 8609c77a3cbdd66c950016720f99dd7ed47c1884 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 20 Aug 2025 07:53:14 +0200 Subject: [PATCH 5/6] 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 93834cbee9de67898e0da04e5e6ec670d4fe15ea Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 20 Aug 2025 08:07:05 +0200 Subject: [PATCH 6/6] 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}'.