From 7e33c58af7cff5c90c6f80ee479380361df336ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Dec 2025 08:32:40 +0000 Subject: [PATCH 1/5] Initial plan From 20ba4f9a6ec431bf4f20e4a907c950887b26f8bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Dec 2025 08:41:42 +0000 Subject: [PATCH 2/5] Remove duplicated SDK environment variable log messages These log messages were cluttering the structured log viewer with repeated messages about DOTNET_HOST_PATH and other SDK environment variables. Since these messages report normal expected behavior and aren't actionable for users, they have been removed entirely. Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> --- src/Build/Instance/ProjectInstance.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Build/Instance/ProjectInstance.cs b/src/Build/Instance/ProjectInstance.cs index fe0cdee00e6..cba611bf566 100644 --- a/src/Build/Instance/ProjectInstance.cs +++ b/src/Build/Instance/ProjectInstance.cs @@ -1390,13 +1390,11 @@ public void AddSdkResolvedEnvironmentVariable(string name, string value) // If the property has already been set as an environment variable, we do not overwrite it. if (_environmentVariableProperties.Contains(name)) { - _loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableAlreadySet", name, value); return; } // If another SDK already set it, we do not overwrite it. else if (_sdkResolvedEnvironmentVariableProperties?.Contains(name) == true) { - _loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableAlreadySetBySdk", name, value); return; } @@ -1412,8 +1410,6 @@ public void AddSdkResolvedEnvironmentVariable(string name, string value) ((IEvaluatorData)this) .SetProperty(name, value, isGlobalProperty: false, mayBeReserved: false, loggingContext: _loggingContext, isEnvironmentVariable: true, isCommandLineProperty: false); } - - _loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableSet", name, value); } /// From 743e2d2156948e47da74110ede59c1415d982654 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Dec 2025 10:10:59 +0000 Subject: [PATCH 3/5] Remove unused SDK environment variable string resources The string resources SdkEnvironmentVariableAlreadySet, SdkEnvironmentVariableAlreadySetBySdk, and SdkEnvironmentVariableSet are no longer used after removing the log messages that referenced them. This removes them from Strings.resx and all localized .xlf files. Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> --- src/Build/Resources/Strings.resx | 10 +--------- src/Build/Resources/xlf/Strings.cs.xlf | 15 --------------- src/Build/Resources/xlf/Strings.de.xlf | 15 --------------- src/Build/Resources/xlf/Strings.es.xlf | 15 --------------- src/Build/Resources/xlf/Strings.fr.xlf | 15 --------------- src/Build/Resources/xlf/Strings.it.xlf | 15 --------------- src/Build/Resources/xlf/Strings.ja.xlf | 15 --------------- src/Build/Resources/xlf/Strings.ko.xlf | 15 --------------- src/Build/Resources/xlf/Strings.pl.xlf | 15 --------------- src/Build/Resources/xlf/Strings.pt-BR.xlf | 15 --------------- src/Build/Resources/xlf/Strings.ru.xlf | 15 --------------- src/Build/Resources/xlf/Strings.tr.xlf | 15 --------------- src/Build/Resources/xlf/Strings.zh-Hans.xlf | 15 --------------- src/Build/Resources/xlf/Strings.zh-Hant.xlf | 15 --------------- 14 files changed, 1 insertion(+), 204 deletions(-) diff --git a/src/Build/Resources/Strings.resx b/src/Build/Resources/Strings.resx index 68b59de6ee8..4b425d62fdb 100644 --- a/src/Build/Resources/Strings.resx +++ b/src/Build/Resources/Strings.resx @@ -1383,15 +1383,7 @@ Errors: {3} MSB4238: The name "{0}" is not a valid SDK name. {StrBegin="MSB4238: "} - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - - - An SDK attempted set the environment variable "{0}" to "{1}". - + MSB4189: <{1}> is not a valid child of the <{0}> element. {StrBegin="MSB4189: "} diff --git a/src/Build/Resources/xlf/Strings.cs.xlf b/src/Build/Resources/xlf/Strings.cs.xlf index 86d6fc9c60c..8704d7977fd 100644 --- a/src/Build/Resources/xlf/Strings.cs.xlf +++ b/src/Build/Resources/xlf/Strings.cs.xlf @@ -906,21 +906,6 @@ Chyby: {3} Překladač sady SDK „{0}“ vrátil hodnotu null. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Sada SDK se pokusila nastavit proměnnou prostředí {0} na {1}, která ale již byla nastavena jako proměnná prostředí. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Sada SDK se pokusila nastavit proměnnou prostředí {0} na {1}, která ale už byla nastavena jinou sadou SDK. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Sada SDK se pokusila nastavit proměnnou prostředí {0} na {1}. - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Sadu SDK {0} se nepodařilo vyřešit pomocí překladače sady SDK {1}. {2} diff --git a/src/Build/Resources/xlf/Strings.de.xlf b/src/Build/Resources/xlf/Strings.de.xlf index 4adaf0b3973..07651280203 100644 --- a/src/Build/Resources/xlf/Strings.de.xlf +++ b/src/Build/Resources/xlf/Strings.de.xlf @@ -906,21 +906,6 @@ Fehler: {3} Der SDK-Resolver "{0}" hat NULL zurückgegeben. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Ein SDK hat versucht, die Umgebungsvariable „{0}“ auf „{1}“ festzulegen, sie wurde aber bereits als Umgebungsvariable festgelegt. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Ein SDK hat versucht, die Umgebungsvariable „{0}“ auf „{1}“ festzulegen, sie wurde aber bereits von einem anderen SDK festgelegt. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Ein SDK hat versucht, die Umgebungsvariable „{0}“ auf „{1}“ festzulegen. - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK „{0}“ konnte vom SDK-Resolver „{1}“ nicht aufgelöst werden. {2} diff --git a/src/Build/Resources/xlf/Strings.es.xlf b/src/Build/Resources/xlf/Strings.es.xlf index ed841430d86..a5ab5b683e3 100644 --- a/src/Build/Resources/xlf/Strings.es.xlf +++ b/src/Build/Resources/xlf/Strings.es.xlf @@ -906,21 +906,6 @@ Errores: {3} La resolución del SDK "{0}" devolvió null. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Un SDK intentó establecer la variable de entorno "{0}" en "{1}", pero ya se estableció como variable de entorno. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Un SDK intentó establecer la variable de entorno "{0}" en "{1}", pero ya la estableció otro SDK. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Un SDK intentó establecer la variable de entorno "{0}" en "{1}". - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} El SDK '{0}' no se pudo resolver mediante la resolución de SDK '{1}'. {2} diff --git a/src/Build/Resources/xlf/Strings.fr.xlf b/src/Build/Resources/xlf/Strings.fr.xlf index 2a866b00d4e..3f0617fd00c 100644 --- a/src/Build/Resources/xlf/Strings.fr.xlf +++ b/src/Build/Resources/xlf/Strings.fr.xlf @@ -906,21 +906,6 @@ Erreurs : {3} Le programme de résolution du Kit de développement logiciel (SDK) «{0}» a retourné null. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Un Kit de développement logiciel (SDK) a tenté de définir la variable d’environnement « {0} » à « {1} », alors qu'elle était déjà définie en tant que variable d'environnement. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Un Kit de développement logiciel (SDK) a tenté de définir la variable d’environnement « {0} » à « {1} », mais elle était déjà définie par un autre SDK. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Un Kit de développement logiciel (SDK) a tenté de définir la variable d’environnement « {0} » à « {1} ». - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Le Kit de développement logiciel (SDK) « {0} » n’a pas pu être résolu par le résolveur de SDK « {1} ». {2} diff --git a/src/Build/Resources/xlf/Strings.it.xlf b/src/Build/Resources/xlf/Strings.it.xlf index 99d4affd579..88509eaec8d 100644 --- a/src/Build/Resources/xlf/Strings.it.xlf +++ b/src/Build/Resources/xlf/Strings.it.xlf @@ -906,21 +906,6 @@ Errori: {3} Il resolver SDK "{0}" ha restituito null. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Un SDK ha tentato di impostare la variabile di ambiente "{0}" su "{1}" ma era già stata impostata come variabile di ambiente. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Un SDK ha tentato di impostare la variabile di ambiente "{0}" su "{1}" ma era già stata impostata da un altro SDK. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Un SDK ha tentato di impostare la variabile di ambiente "{0}" su "{1}". - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Il resolver SDK '{0}' non è riuscito a risolvere l'SDK '{1}'. {2} diff --git a/src/Build/Resources/xlf/Strings.ja.xlf b/src/Build/Resources/xlf/Strings.ja.xlf index 38b60d181d3..c21c83adcbd 100644 --- a/src/Build/Resources/xlf/Strings.ja.xlf +++ b/src/Build/Resources/xlf/Strings.ja.xlf @@ -906,21 +906,6 @@ Errors: {3} SDK リゾルバー "{0}" が null を返しました。 - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - SDK は環境変数 "{0}" を "{1}" に設定しようとしましたが、それは既に環境変数として設定されていました。 - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - SDK は環境変数 "{0}" を "{1}" に設定しようとしましたが、それは既に別の SDK によって設定されていました。 - - - - An SDK attempted set the environment variable "{0}" to "{1}". - SDK が環境変数 "{0}" を "{1}" に設定しようとしました。 - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK '{0}' を SDK リゾルバー '{1}' で解決できませんでした。{2} diff --git a/src/Build/Resources/xlf/Strings.ko.xlf b/src/Build/Resources/xlf/Strings.ko.xlf index e5aa1a02533..00d4671420e 100644 --- a/src/Build/Resources/xlf/Strings.ko.xlf +++ b/src/Build/Resources/xlf/Strings.ko.xlf @@ -906,21 +906,6 @@ Errors: {3} SDK 확인자 "{0}"이(가) null을 반환했습니다. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - SDK가 환경 변수 "{0}"을(를) "{1}"(으)로 설정하려고 했지만 이미 환경 변수로 설정되었습니다. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - SDK가 환경 변수 "{0}"을(를) "{1}"(으)로 설정하려고 했지만 이미 다른 SDK에 의해 설정되었습니다. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - SDK가 환경 변수 "{0}"을(를) "{1}"(으)로 설정하려고 했습니다. - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK 확인자 '{1}'에서 SDK '{0}'을(를) 확인할 수 없습니다. {2} diff --git a/src/Build/Resources/xlf/Strings.pl.xlf b/src/Build/Resources/xlf/Strings.pl.xlf index 866d90bcd9d..7ccef694ba4 100644 --- a/src/Build/Resources/xlf/Strings.pl.xlf +++ b/src/Build/Resources/xlf/Strings.pl.xlf @@ -906,21 +906,6 @@ Błędy: {3} Narzędzie Resolver zestawu SDK „{0}” zwróciło wartość null. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Zestaw SDK próbował ustawić zmienną środowiskową „{0}” na „{1}”, ale została już ustawiona jako zmienna środowiskowa. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Zestaw SDK próbował ustawić zmienną środowiskową „{0}” na „{1}”, ale została już ustawiona przez inny zestaw SDK. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Zestaw SDK próbował ustawić zmienną środowiskową „{0}” na „{1}”. - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Nie można rozpoznać zestawu SDK „{0}” przez program rozpoznawania nazw zestawu SDK „{1}”. {2} diff --git a/src/Build/Resources/xlf/Strings.pt-BR.xlf b/src/Build/Resources/xlf/Strings.pt-BR.xlf index d27c50e5464..c7b388b527e 100644 --- a/src/Build/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Build/Resources/xlf/Strings.pt-BR.xlf @@ -906,21 +906,6 @@ Erros: {3} O resolvedor do SDK "{0}" retornou nulo. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Um SDK tentou definir a variável de ambiente "{0}" como "{1}", mas ela já foi definida como variável de ambiente. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Um SDK tentou definir a variável de ambiente "{0}" como "{1}", mas ela já foi definida por outro SDK. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Um SDK tentou definir a variável de ambiente "{0}" como "{1}". - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} O SDK '{0}' não pôde ser resolvido pelo resolvedor de SDK '{1}'. {2} diff --git a/src/Build/Resources/xlf/Strings.ru.xlf b/src/Build/Resources/xlf/Strings.ru.xlf index 55d613e49cd..473692ef102 100644 --- a/src/Build/Resources/xlf/Strings.ru.xlf +++ b/src/Build/Resources/xlf/Strings.ru.xlf @@ -906,21 +906,6 @@ Errors: {3} Сопоставитель пакетов SDK "{0}" вернул значение null. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Пакет SDK попытался настроить для переменной среды "{0}" значение "{1}", но она уже была настроена в качестве переменной среды. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Пакет SDK попытался настроить для переменной среды "{0}" значение "{1}", но она уже была настроена другим пакетом SDK. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Пакет SDK попытался настроить для переменной среды "{0}" значение "{1}". - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Не удалось разрешить SDK "{0}" с помощью сопоставителя SDK "{1}". {2} diff --git a/src/Build/Resources/xlf/Strings.tr.xlf b/src/Build/Resources/xlf/Strings.tr.xlf index 7a5e481602b..6d259ca925e 100644 --- a/src/Build/Resources/xlf/Strings.tr.xlf +++ b/src/Build/Resources/xlf/Strings.tr.xlf @@ -906,21 +906,6 @@ Hatalar: {3} SDK çözümleyici "{0}" null döndürdü. - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - Bir SDK "{0}" ortam değişkenini "{1}" olarak ayarlamaya çalıştı ancak bu değişken zaten bir ortam değişkeni olarak ayarlanmıştı. - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - Bir SDK "{0}" ortam değişkenini "{1}" olarak ayarlamaya çalıştı ancak bu değişken zaten başka bir SDK tarafından ayarlanmıştı. - - - - An SDK attempted set the environment variable "{0}" to "{1}". - Bir SDK, "{0}" ortam değişkenini "{1}" olarak ayarlamaya çalıştı. - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK '{0}', SDK çözümleyici '{1}' tarafından çözümlenemedi. {2} diff --git a/src/Build/Resources/xlf/Strings.zh-Hans.xlf b/src/Build/Resources/xlf/Strings.zh-Hans.xlf index d8da78803bc..242688b4a6e 100644 --- a/src/Build/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Build/Resources/xlf/Strings.zh-Hans.xlf @@ -906,21 +906,6 @@ Errors: {3} SDK 解析程序“{0}”返回 null。 - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - SDK 尝试将环境变量 "{0}" 设置为 "{1}",但它已设置为环境变量。 - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - SDK 尝试将环境变量 "{0}" 设置为 "{1}",但已由另一个 SDK 设置。 - - - - An SDK attempted set the environment variable "{0}" to "{1}". - SDK 尝试将环境变量 "{0}" 设置为 "{1}"。 - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK 解析程序“{1}”无法解析 SDK“{0}”。{2} diff --git a/src/Build/Resources/xlf/Strings.zh-Hant.xlf b/src/Build/Resources/xlf/Strings.zh-Hant.xlf index d851b21ba23..e002cee203d 100644 --- a/src/Build/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Build/Resources/xlf/Strings.zh-Hant.xlf @@ -906,21 +906,6 @@ Errors: {3} SDK 解析程式 "{0}" 傳回 Null。 - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set as an environment variable. - 一個 SDK 嘗試將環境變數 "{0}" 設定為 "{1}",但該變數已設定為環境變數。 - - - - An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set by another SDK. - 一個 SDK 嘗試將環境變數 "{0}" 設定為 "{1}",但該變數已由另一個 SDK 設定。 - - - - An SDK attempted set the environment variable "{0}" to "{1}". - 一個 SDK 嘗試將環境變數 "{0}" 設定為 "{1}"。 - - SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK 解析程式 '{1}' 無法解析 SDK '{0}'。{2} From 6571644a408ca4cf774dcd804370a15cce417ef2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Dec 2025 09:39:26 +0000 Subject: [PATCH 4/5] Only log SDK environment variable messages when values differ Per feedback from @rainersigwald, changed the logging behavior to only emit messages when an SDK attempts to set an environment variable to a different value than what's already set. This reduces noise while still alerting users to potential conflicts. Changes: - Modified AddSdkResolvedEnvironmentVariable to check if values differ before logging - Updated string resources to include both the attempted and existing values in the message - Restored string resources to Strings.resx and all xlf files with updated messages that show both values This addresses the original issue of duplicate messages cluttering logs while preserving diagnostic information about actual conflicts. Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> --- src/Build/Instance/ProjectInstance.cs | 12 ++++++++++++ src/Build/Resources/Strings.resx | 6 ++++++ src/Build/Resources/xlf/Strings.cs.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.de.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.es.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.fr.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.it.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.ja.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.ko.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.pl.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.pt-BR.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.ru.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.tr.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.zh-Hans.xlf | 11 +++++++++++ src/Build/Resources/xlf/Strings.zh-Hant.xlf | 11 +++++++++++ 15 files changed, 161 insertions(+) diff --git a/src/Build/Instance/ProjectInstance.cs b/src/Build/Instance/ProjectInstance.cs index cba611bf566..f928b2b9a6d 100644 --- a/src/Build/Instance/ProjectInstance.cs +++ b/src/Build/Instance/ProjectInstance.cs @@ -1390,11 +1390,23 @@ public void AddSdkResolvedEnvironmentVariable(string name, string value) // If the property has already been set as an environment variable, we do not overwrite it. if (_environmentVariableProperties.Contains(name)) { + // Only log if the value differs from what's already set + ProjectPropertyInstance existingProperty = _environmentVariableProperties.GetProperty(name); + if (existingProperty != null && !string.Equals(existingProperty.EvaluatedValue, value, StringComparison.Ordinal)) + { + _loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableAlreadySet", name, value, existingProperty.EvaluatedValue); + } return; } // If another SDK already set it, we do not overwrite it. else if (_sdkResolvedEnvironmentVariableProperties?.Contains(name) == true) { + // Only log if the value differs from what's already set + ProjectPropertyInstance existingProperty = _sdkResolvedEnvironmentVariableProperties.GetProperty(name); + if (existingProperty != null && !string.Equals(existingProperty.EvaluatedValue, value, StringComparison.Ordinal)) + { + _loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableAlreadySetBySdk", name, value, existingProperty.EvaluatedValue); + } return; } diff --git a/src/Build/Resources/Strings.resx b/src/Build/Resources/Strings.resx index 4b425d62fdb..95da5690fa1 100644 --- a/src/Build/Resources/Strings.resx +++ b/src/Build/Resources/Strings.resx @@ -1383,6 +1383,12 @@ Errors: {3} MSB4238: The name "{0}" is not a valid SDK name. {StrBegin="MSB4238: "} + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + MSB4189: <{1}> is not a valid child of the <{0}> element. diff --git a/src/Build/Resources/xlf/Strings.cs.xlf b/src/Build/Resources/xlf/Strings.cs.xlf index 8704d7977fd..026ed4209ae 100644 --- a/src/Build/Resources/xlf/Strings.cs.xlf +++ b/src/Build/Resources/xlf/Strings.cs.xlf @@ -906,6 +906,17 @@ Chyby: {3} Překladač sady SDK „{0}“ vrátil hodnotu null. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Sadu SDK {0} se nepodařilo vyřešit pomocí překladače sady SDK {1}. {2} diff --git a/src/Build/Resources/xlf/Strings.de.xlf b/src/Build/Resources/xlf/Strings.de.xlf index 07651280203..be3c31d7318 100644 --- a/src/Build/Resources/xlf/Strings.de.xlf +++ b/src/Build/Resources/xlf/Strings.de.xlf @@ -906,6 +906,17 @@ Fehler: {3} Der SDK-Resolver "{0}" hat NULL zurückgegeben. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK „{0}“ konnte vom SDK-Resolver „{1}“ nicht aufgelöst werden. {2} diff --git a/src/Build/Resources/xlf/Strings.es.xlf b/src/Build/Resources/xlf/Strings.es.xlf index a5ab5b683e3..d36690c8d8b 100644 --- a/src/Build/Resources/xlf/Strings.es.xlf +++ b/src/Build/Resources/xlf/Strings.es.xlf @@ -906,6 +906,17 @@ Errores: {3} La resolución del SDK "{0}" devolvió null. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} El SDK '{0}' no se pudo resolver mediante la resolución de SDK '{1}'. {2} diff --git a/src/Build/Resources/xlf/Strings.fr.xlf b/src/Build/Resources/xlf/Strings.fr.xlf index 3f0617fd00c..cb5f6f9f57b 100644 --- a/src/Build/Resources/xlf/Strings.fr.xlf +++ b/src/Build/Resources/xlf/Strings.fr.xlf @@ -906,6 +906,17 @@ Erreurs : {3} Le programme de résolution du Kit de développement logiciel (SDK) «{0}» a retourné null. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Le Kit de développement logiciel (SDK) « {0} » n’a pas pu être résolu par le résolveur de SDK « {1} ». {2} diff --git a/src/Build/Resources/xlf/Strings.it.xlf b/src/Build/Resources/xlf/Strings.it.xlf index 88509eaec8d..908c3afe6e0 100644 --- a/src/Build/Resources/xlf/Strings.it.xlf +++ b/src/Build/Resources/xlf/Strings.it.xlf @@ -906,6 +906,17 @@ Errori: {3} Il resolver SDK "{0}" ha restituito null. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Il resolver SDK '{0}' non è riuscito a risolvere l'SDK '{1}'. {2} diff --git a/src/Build/Resources/xlf/Strings.ja.xlf b/src/Build/Resources/xlf/Strings.ja.xlf index c21c83adcbd..be5077cab90 100644 --- a/src/Build/Resources/xlf/Strings.ja.xlf +++ b/src/Build/Resources/xlf/Strings.ja.xlf @@ -906,6 +906,17 @@ Errors: {3} SDK リゾルバー "{0}" が null を返しました。 + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK '{0}' を SDK リゾルバー '{1}' で解決できませんでした。{2} diff --git a/src/Build/Resources/xlf/Strings.ko.xlf b/src/Build/Resources/xlf/Strings.ko.xlf index 00d4671420e..8d3b59f5ec8 100644 --- a/src/Build/Resources/xlf/Strings.ko.xlf +++ b/src/Build/Resources/xlf/Strings.ko.xlf @@ -906,6 +906,17 @@ Errors: {3} SDK 확인자 "{0}"이(가) null을 반환했습니다. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK 확인자 '{1}'에서 SDK '{0}'을(를) 확인할 수 없습니다. {2} diff --git a/src/Build/Resources/xlf/Strings.pl.xlf b/src/Build/Resources/xlf/Strings.pl.xlf index 7ccef694ba4..663194899f7 100644 --- a/src/Build/Resources/xlf/Strings.pl.xlf +++ b/src/Build/Resources/xlf/Strings.pl.xlf @@ -906,6 +906,17 @@ Błędy: {3} Narzędzie Resolver zestawu SDK „{0}” zwróciło wartość null. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Nie można rozpoznać zestawu SDK „{0}” przez program rozpoznawania nazw zestawu SDK „{1}”. {2} diff --git a/src/Build/Resources/xlf/Strings.pt-BR.xlf b/src/Build/Resources/xlf/Strings.pt-BR.xlf index c7b388b527e..f38690c4d33 100644 --- a/src/Build/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Build/Resources/xlf/Strings.pt-BR.xlf @@ -906,6 +906,17 @@ Erros: {3} O resolvedor do SDK "{0}" retornou nulo. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} O SDK '{0}' não pôde ser resolvido pelo resolvedor de SDK '{1}'. {2} diff --git a/src/Build/Resources/xlf/Strings.ru.xlf b/src/Build/Resources/xlf/Strings.ru.xlf index 473692ef102..612f94ddbed 100644 --- a/src/Build/Resources/xlf/Strings.ru.xlf +++ b/src/Build/Resources/xlf/Strings.ru.xlf @@ -906,6 +906,17 @@ Errors: {3} Сопоставитель пакетов SDK "{0}" вернул значение null. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} Не удалось разрешить SDK "{0}" с помощью сопоставителя SDK "{1}". {2} diff --git a/src/Build/Resources/xlf/Strings.tr.xlf b/src/Build/Resources/xlf/Strings.tr.xlf index 6d259ca925e..aa8290cc5ea 100644 --- a/src/Build/Resources/xlf/Strings.tr.xlf +++ b/src/Build/Resources/xlf/Strings.tr.xlf @@ -906,6 +906,17 @@ Hatalar: {3} SDK çözümleyici "{0}" null döndürdü. + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK '{0}', SDK çözümleyici '{1}' tarafından çözümlenemedi. {2} diff --git a/src/Build/Resources/xlf/Strings.zh-Hans.xlf b/src/Build/Resources/xlf/Strings.zh-Hans.xlf index 242688b4a6e..e3e48f00b27 100644 --- a/src/Build/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Build/Resources/xlf/Strings.zh-Hans.xlf @@ -906,6 +906,17 @@ Errors: {3} SDK 解析程序“{0}”返回 null。 + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK 解析程序“{1}”无法解析 SDK“{0}”。{2} diff --git a/src/Build/Resources/xlf/Strings.zh-Hant.xlf b/src/Build/Resources/xlf/Strings.zh-Hant.xlf index e002cee203d..d7de7350890 100644 --- a/src/Build/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Build/Resources/xlf/Strings.zh-Hant.xlf @@ -906,6 +906,17 @@ Errors: {3} SDK 解析程式 "{0}" 傳回 Null。 + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" as an environment variable. + + + + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + An SDK attempted to set the environment variable "{0}" to "{1}" but it was already set to "{2}" by another SDK. + + + SDK '{0}' could not be resolved by the SDK resolver '{1}'. {2} SDK 解析程式 '{1}' 無法解析 SDK '{0}'。{2} From 82fe9b2292992ff45d9594d3902150267f0db335 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Dec 2025 09:54:09 +0000 Subject: [PATCH 5/5] Refactor duplicate code into helper method Extracted the duplicated value comparison and logging logic from AddSdkResolvedEnvironmentVariable into a new helper method LogIfValueDiffers. This eliminates code duplication while maintaining the same functionality. Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> --- src/Build/Instance/ProjectInstance.cs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Build/Instance/ProjectInstance.cs b/src/Build/Instance/ProjectInstance.cs index f928b2b9a6d..da0ac9603d0 100644 --- a/src/Build/Instance/ProjectInstance.cs +++ b/src/Build/Instance/ProjectInstance.cs @@ -1390,23 +1390,13 @@ public void AddSdkResolvedEnvironmentVariable(string name, string value) // If the property has already been set as an environment variable, we do not overwrite it. if (_environmentVariableProperties.Contains(name)) { - // Only log if the value differs from what's already set - ProjectPropertyInstance existingProperty = _environmentVariableProperties.GetProperty(name); - if (existingProperty != null && !string.Equals(existingProperty.EvaluatedValue, value, StringComparison.Ordinal)) - { - _loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableAlreadySet", name, value, existingProperty.EvaluatedValue); - } + LogIfValueDiffers(_environmentVariableProperties, name, value, "SdkEnvironmentVariableAlreadySet"); return; } // If another SDK already set it, we do not overwrite it. else if (_sdkResolvedEnvironmentVariableProperties?.Contains(name) == true) { - // Only log if the value differs from what's already set - ProjectPropertyInstance existingProperty = _sdkResolvedEnvironmentVariableProperties.GetProperty(name); - if (existingProperty != null && !string.Equals(existingProperty.EvaluatedValue, value, StringComparison.Ordinal)) - { - _loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableAlreadySetBySdk", name, value, existingProperty.EvaluatedValue); - } + LogIfValueDiffers(_sdkResolvedEnvironmentVariableProperties, name, value, "SdkEnvironmentVariableAlreadySetBySdk"); return; } @@ -1424,6 +1414,18 @@ public void AddSdkResolvedEnvironmentVariable(string name, string value) } } + /// + /// Helper method to log a message if the attempted value differs from the existing value. + /// + private void LogIfValueDiffers(PropertyDictionary propertyDictionary, string name, string attemptedValue, string messageResourceName) + { + ProjectPropertyInstance existingProperty = propertyDictionary.GetProperty(name); + if (existingProperty != null && !string.Equals(existingProperty.EvaluatedValue, attemptedValue, StringComparison.Ordinal)) + { + _loggingContext.LogComment(MessageImportance.Low, messageResourceName, name, attemptedValue, existingProperty.EvaluatedValue); + } + } + /// /// List of names of the properties that, while global, are still treated as overridable ///