diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx
index 781d470c54bf..9d7f30556d26 100644
--- a/src/Tasks/Common/Resources/Strings.resx
+++ b/src/Tasks/Common/Resources/Strings.resx
@@ -649,4 +649,9 @@ The following are names of parameters or literal values and should not be transl
NETSDK1136: The target platform identifier {0} was not recognized.{StrBegin="NETSDK1136: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+
diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
index 969179b064ab..d421c0bf9cd1 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: Hodnota RollForward {0} je neplatná. Povolené jsou tyto hodnoty: {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: Projekt byl obnoven pomocí aplikace {0} verze {1}, ale s aktuálním nastavením by se místo toho použít verze {2}. Tento problém vyřešíte tak, že zkontrolujete, že se pro obnovení a následné operace, například sestavení nebo publikování, používá stejné nastavení. Obvykle k tomuto problému může dojít, pokud je vlastnost RuntimeIdentifier nastavena při sestavování nebo publikování, ale ne při obnovování. Další informace najdete na stránce https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf
index 2bb5b725a4f7..416f89b041ad 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: Der RollForward-Wert "{0}" ist ungültig. Zulässige Werte: {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: Das Projekt wurde mit {0}, Version {1} wiederhergestellt, aber mit den aktuellen Einstellungen würde stattdessen Version {2} verwendet werden. Um dieses Problem zu beheben, müssen Sie sicherstellen, dass für die Wiederherstellung und für nachfolgende Vorgänge wie das Kompilieren oder Veröffentlichen dieselben Einstellungen verwendet werden. Dieses Problem tritt typischerweise auf, wenn die RuntimeIdentifier-Eigenschaft bei der Kompilierung oder Veröffentlichung, aber nicht bei der Wiederherstellung festgelegt wird. Weitere Informationen finden Sie unter https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf
index 73a9ede99c45..3b5bb3d0c23c 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: El valor "{0}" de RollForward no es válido. Los valores permitidos son: {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: El proyecto fue restaurado utilizando la versión {0} {1}, pero con la configuración actual, la versión {2} se utilizaría en su lugar. Para resolver este problema, asegúrese de que la misma configuración se utiliza para restaurar y para operaciones posteriores como compilar o publicar. Normalmente, este problema puede producirse si la `propiedad RuntimeIdentifier se establece durante la compilación o la publicación pero no durante la restauración. Para obtener más información, consulte https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
index c931edf111eb..360ed8b4e65b 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: la valeur RollForward '{0}' est non valide. Les valeurs autorisées sont {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: Le projet a été restauré avec la version {0} {1}, mais avec les paramètres actuels, la version {2} serait utilisée à la place. Pour résoudre ce problème, assurez-vous que les mêmes paramètres sont utilisés pour la restauration et pour les opérations ultérieures telles que la génération et la publication. Généralement, ce problème peut se produire si la propriété RuntimeIdentifier est définie au cours de la génération ou de la publication, mais pas pendant la restauration. Pour plus d’informations, consultez https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf
index dbba9f121586..2978b60f4709 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: il valore '{0}' di RollForward non è valido. I valori consentiti sono {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: per il ripristino del progetto è stato usato {0} versione {1}, ma con le impostazioni correnti viene usata la versione {2}. Per risolvere il problema, assicurarsi di usare le stesse impostazioni per il ripristino e per le operazioni successive, quali compilazione o pubblicazione. In genere questo problema può verificarsi se la proprietà RuntimeIdentifier viene impostata durante la compilazione o la pubblicazione, ma non durante il ripristino. Per altre informazioni, vedere https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
index 4a101ac116d9..1250374f3d33 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: ロールフォワード値 '{0}' が無効です。許可されている値は {1} です。{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: プロジェクトは {0} バージョン {1} を使用して復元されましたが、現在の設定では、バージョン {2} が代わりに使用されます。この問題を解決するには、復元およびこれ以降の操作 (ビルドや公開など) で同じ設定を使用していることをご確認ください。通常この問題は、ビルドや公開の実行時に RuntimeIdentifier プロパティを設定したが、復元時には設定していない場合に発生することがあります。詳しくは、https://aka.ms/dotnet-runtime-patch-selection を参照してください。
diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
index fef722efb5ec..e3b1a7550045 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: RollForward 값 '{0}'이(가) 잘못되었습니다. 허용되는 값은 {1}입니다.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: {0} 버전 {1}을(를) 사용하여 프로젝트가 복원되었지만, 현재 설정에서는 버전 {2}을(를) 대신 사용합니다. 이 문제를 해결하려면 복원 및 후속 작업(예: 빌드 또는 게시)에 동일한 설정을 사용해야 합니다. 일반적으로 이 문제는 RuntimeIdentifier 속성이 빌드 또는 게시 중에 설정되었지만, 복원 중에는 설정되지 않은 경우에 발생할 수 있습니다. 자세한 내용은 https://aka.ms/dotnet-runtime-patch-selection을 참조하세요.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
index 4ec935337000..7d7f027224ca 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: Wartość RollForward „{0}” jest nieprawidłowa. Dozwolone wartości to {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: Projekt został przywrócony przy użyciu pakietu {0} w wersji {1}, ale w przypadku bieżących ustawień zamiast niej zostałaby użyta wersja {2}. Aby rozwiązać ten problem, upewnij się, że te same ustawienia są używane do przywracania i dla kolejnych operacji, takich jak kompilacja lub publikowanie. Ten problem zazwyczaj występuje, gdy właściwość RuntimeIdentifier jest ustawiona podczas kompilacji lub publikowania, ale nie podczas przywracania. Aby uzyskać więcej informacji, zobacz https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
index 0ffbf625fa54..bef81f297da0 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: o valor de RollForward '{0}' é inválido. Os valores permitidos são {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: o projeto foi restaurado usando o {0} versão {1}, mas, com as configurações atuais, a versão {2} seria usada. Para resolver esse problema, verifique se as mesmas configurações são usadas para restauração e para operações subsequentes, como compilação ou publicação. Normalmente, esse problema poderá ocorrer se a propriedade RuntimeIdentifier for definida durante a compilação ou a publicação, mas não durante a restauração. Para obter mais informações, consulte https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
index a44802c3bcb1..8197f2d0c813 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: недопустимое значение RollForward "{0}". Разрешенные значения — {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: Проект был восстановлен с использованием {0} версии {1}, но с текущими параметрами вместо этой версии будет использована версия {2}. Чтобы устранить эту проблему, убедитесь, что для восстановления и последующих операций (таких как сборка или публикация) используются одинаковые параметры. Обычно эта проблема возникает, когда свойство RuntimeIdentifier устанавливается во время сборки или публикации, но не во время восстановления. Дополнительные сведения см. на странице https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
index 858cfe54f888..06133c83bf5f 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: '{0}' RollForward değeri geçersiz. İzin verilen değerler {1}.{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: Proje, {0} sürüm {1} kullanılarak geri yüklendi, ancak geçerli ayarlarla, bunun yerine sürüm {2} kullanılması gerekiyordu. Bu sorunu çözmek amacıyla, geri yükleme için ve derleme veya yayımlama gibi sonraki işlemler için aynı ayarların kullanıldığından emin olun. Bu sorun genellikle RuntimeIdentifier özelliği derleme veya yayımlama sırasında ayarlandığında ancak geri yükleme sırasında ayarlanmadığında oluşur. Daha fazla bilgi için bkz. https://aka.ms/dotnet-runtime-patch-selection.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
index fdb27871687c..e75184ce19eb 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: RollForward 值“{0}”无效。允许的值为 {1}。{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: 项目是使用 {0} 版本 {1} 还原的, 但使用当前设置, 将改用版本 {2}。要解决此问题, 请确保将相同的设置用于还原和后续操作 (如生成或发布)。通常, 如果 RuntimeIdentifier 属性是在生成或发布过程中设置的, 而不是在还原过程中进行的, 则会发生此问题。有关详细信息, 请参阅 https://aka.ms/dotnet-runtime-patch-selection。
diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
index 5b2271fb1b1a..feb4d9439ff0 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
@@ -395,6 +395,13 @@ The following are names of parameters or literal values and should not be transl
NETSDK1104: RollForward 值 '{0}' 無效。允許的值為 {1}。{StrBegin="NETSDK1104: "}
+
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ NETSDK1137: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include:
+{2}
+ {StrBegin="NETSDK1137: "}
+ NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.NETSDK1061: 專案是使用 {0} 版本 {1} 還原的,但依照目前設定,使用的版本會是 {2}。若要解決此問題,請確認用於還原與後續作業 (例如建置或發佈) 的設定相同。一般而言,若在建置或發佈期間設定了 RuntimeIdentifier,但在還原期間未加以設定,就可能發生這個問題。如需詳細資訊,請參閱 https://aka.ms/dotnet-runtime-patch-selection。
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets
index 3703921cac95..09b0d7bd5b68 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets
@@ -16,6 +16,7 @@ Copyright (c) .NET Foundation. All rights reserved.
+
+
+
+
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets
index ede74b176a7b..632dcbc931a6 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets
@@ -160,6 +160,16 @@ Copyright (c) .NET Foundation. All rights reserved.
ResourceName="CppRequiresTFMVersion31"
/>
+
+
+ <_EnableDefaultWindowsPlatform>false
+ false
+
+
+
+
+ Windows
+ 2.1
@@ -188,6 +198,24 @@ Copyright (c) .NET Foundation. All rights reserved.
FormatArguments="$(MinimumOSPlatform);$(TargetPlatformVersion)"/>
+
+
+
+
+
+
+ true
+ @(SupportedTargetPlatform, '%0a')
+ None
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
index 05d8170581d6..510a1120169f 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
@@ -417,13 +417,13 @@ public void It_implicitly_defines_compilation_constants_for_the_target_framework
itemGroup.Add(supportedFramework);
});
- AssertDefinedConstantsOutput(testAsset, targetFramework, new[] { "NETCOREAPP", "NET", "WINDOWS", "WINDOWS7_0" }.Concat(expectedDefines).ToArray());
+ AssertDefinedConstantsOutput(testAsset, targetFramework, new[] { "NETCOREAPP", "NET"}.Concat(expectedDefines).ToArray());
}
[Theory]
[InlineData("ios", "1.1", new[] { "IOS", "IOS1_1" })]
[InlineData("android", "2.2", new[] { "ANDROID", "ANDROID2_2" })]
- [InlineData("windows", "10.1", new[] { "WINDOWS", "WINDOWS10_1" })]
+ [InlineData("windows", "7.0", new[] { "WINDOWS", "WINDOWS7_0" })]
public void It_implicitly_defines_compilation_constants_for_the_target_platform(string targetPlatformIdentifier, string targetPlatformVersion, string[] expectedDefines)
{
var targetFramework = "net5.0";
@@ -454,7 +454,7 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform(
[Theory]
[InlineData(new[] { "1.0", "1.1" }, "ios", "1.1", new[] { "IOS", "IOS1_1", "IOS1_0" })]
[InlineData(new[] { "11.11", "12.12", "13.13" }, "android", "12.12", new[] { "ANDROID", "ANDROID11_11", "ANDROID12_12" })]
- [InlineData(new[] { "7.0", "8.0", "10.0.19041", "11.0.0" }, "windows", "11.0.0", new[] { "WINDOWS", "WINDOWS7_0", "WINDOWS8_0", "WINDOWS10_0_19041", "WINDOWS11_0_0" })]
+ [InlineData(new string[] { /* Use the built in SupportedTargetPlatform items */}, "windows", "10.0.19041", new[] { "WINDOWS", "WINDOWS7_0", "WINDOWS8_0", "WINDOWS10_0_17763", "WINDOWS10_0_18362", "WINDOWS10_0_19041" })]
public void It_implicitly_defines_compilation_constants_for_the_target_platform_with_backwards_compatibility(string[] supportedTargetPlatform, string targetPlatformIdentifier, string targetPlatformVersion, string[] expectedDefines)
{
var targetFramework = "net5.0";
@@ -605,6 +605,43 @@ public void It_fails_gracefully_if_targetframework_should_be_targetframeworks(bo
$"The TargetFramework value '{targetFramework}' is not valid. To multi-target, use the 'TargetFrameworks' property instead");
}
+ [WindowsOnlyRequiresMSBuildVersionTheory("16.7.0-preview-20310-07")]
+ [InlineData("net5.0", "", false)]
+ [InlineData("net5.0", "UseWPF", true)]
+ [InlineData("net5.0", "UseWindowsForms", true)]
+ [InlineData("netcoreapp3.1", "", true)]
+ public void It_defines_target_platform_defaults_correctly(string targetFramework, string propertyName, bool defaultsDefined)
+ {
+ TestProject testProject = new TestProject()
+ {
+ Name = "TargetPlatformDefaults",
+ IsSdkProject = true,
+ TargetFrameworks = targetFramework
+ };
+
+ if (!propertyName.Equals(string.Empty))
+ {
+ testProject.AdditionalProperties[propertyName] = "true";
+ }
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+
+ var getValuesCommand = new GetValuesCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name), targetFramework, "TargetPlatformIdentifier");
+ getValuesCommand
+ .Execute()
+ .Should()
+ .Pass();
+ var values = getValuesCommand.GetValues();
+ if (defaultsDefined)
+ {
+ values.Count().Should().Be(1);
+ values.FirstOrDefault().Should().Be("Windows");
+ }
+ else
+ {
+ values.Count().Should().Be(0);
+ }
+ }
+
[Theory]
[InlineData("net5.0")]
[InlineData("netcoreapp3.1")]
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs
index de03a97b2a33..32aa67ba4ee5 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs
@@ -39,9 +39,9 @@ public void WhenPropertiesAreSetItCanGenerateMinimumOSPlatformAttribute()
var targetPlatformIdentifier = "iOS";
testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
+ testProject.AdditionalProperties["TargetPlatformVersionSupported"] = "true";
testProject.AdditionalProperties["MinimumOSPlatform"] = "13.2";
testProject.AdditionalProperties["TargetPlatformVersion"] = "14.0";
- testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
var testAsset = _testAssetsManager.CreateTestProject(testProject);
@@ -60,8 +60,8 @@ public void WhenMinimumOSPlatformISNotSetTargetPlatformVersionIsSetItCanGenerate
var targetPlatformIdentifier = "iOS";
testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
+ testProject.AdditionalProperties["TargetPlatformVersionSupported"] = "true";
testProject.AdditionalProperties["TargetPlatformVersion"] = "13.2";
- testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
var testAsset = _testAssetsManager.CreateTestProject(testProject);
@@ -79,7 +79,7 @@ public void WhenMinimumOSPlatformIsHigherThanTargetPlatformVersionItShouldError(
var targetPlatformIdentifier = "iOS";
testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
- testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
+ testProject.AdditionalProperties["TargetPlatformVersionSupported"] = "true";
testProject.AdditionalProperties["TargetPlatformVersion"] = "13.2";
testProject.AdditionalProperties["MinimumOSPlatform"] = "14.0";
testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs
index 0afbfeaa3d39..def9568c0323 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs
@@ -195,7 +195,7 @@ public void It_implicitly_defines_compilation_constants_for_the_configuration(st
[InlineData("net45", new[] { "NETFRAMEWORK=-1", "NET45=-1" }, true)]
[InlineData("net461", new[] { "NETFRAMEWORK=-1", "NET461=-1" }, true)]
[InlineData("netcoreapp1.0", new[] { "NETCOREAPP=-1", "NETCOREAPP1_0=-1", "_MyType=\"Empty\"" }, false)]
- [InlineData("net5.0", new[] { "NET=-1", "NET5_0=-1", "NETCOREAPP=-1", "NETCOREAPP3_1=-1", "WINDOWS=-1", "WINDOWS7_0=-1", "_MyType=\"Empty\"" }, false)]
+ [InlineData("net5.0", new[] { "NET=-1", "NET5_0=-1", "NETCOREAPP=-1", "NETCOREAPP3_1=-1", "_MyType=\"Empty\"" }, false)]
[InlineData(".NETPortable,Version=v4.5,Profile=Profile78", new string[] { "_MyType=\"Empty\"" }, false)]
[InlineData(".NETFramework,Version=v4.0,Profile=Client", new string[] { "NETFRAMEWORK=-1", "NET40=-1" }, false)]
[InlineData("Xamarin.iOS,Version=v1.0", new string[] { "XAMARINIOS=-1", "XAMARINIOS1_0=-1", "_MyType=\"Empty\"" }, false)]
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
new file mode 100644
index 000000000000..c367a4cb8f74
--- /dev/null
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
@@ -0,0 +1,59 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using FluentAssertions;
+using Microsoft.NET.TestFramework;
+using Microsoft.NET.TestFramework.Commands;
+using Xunit;
+using Xunit.Abstractions;
+using Microsoft.NET.TestFramework.Assertions;
+using Microsoft.NET.TestFramework.ProjectConstruction;
+
+namespace Microsoft.NET.Build.Tests
+{
+ public class GivenThatWeWantToBuildAWindowsDesktopProject : SdkTest
+ {
+ public GivenThatWeWantToBuildAWindowsDesktopProject(ITestOutputHelper log) : base(log)
+ {}
+
+ [WindowsOnlyFact]
+ public void It_fails_if_windows_target_platform_version_is_invalid()
+ {
+ var testProject = new TestProject()
+ {
+ Name = "InvalidWindowsVersion",
+ IsSdkProject = true,
+ TargetFrameworks = "net5.0-windows1.0"
+ };
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand.Execute()
+ .Should()
+ .Fail()
+ .And
+ .HaveStdOutContaining("NETSDK1137");
+ }
+
+ [Fact]
+ public void It_fails_if_target_platform_identifier_and_version_are_invalid()
+ {
+ var testProject = new TestProject()
+ {
+ Name = "InvalidTargetPlatform",
+ IsSdkProject = true,
+ TargetFrameworks = "net5.0-custom1.0"
+ };
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand.Execute()
+ .Should()
+ .Fail()
+ .And
+ .HaveStdOutContaining("NETSDK1136")
+ .And
+ .NotHaveStdOutContaining("NETSDK1137");
+ }
+ }
+}
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildWithATargetPlatform.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildWithATargetPlatform.cs
index 9f35771dd8bc..1e980ec3caee 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildWithATargetPlatform.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildWithATargetPlatform.cs
@@ -21,7 +21,7 @@ public GivenThatWeWantToBuildWithATargetPlatform(ITestOutputHelper log) : base(l
[WindowsOnlyTheory]
[InlineData("netcoreapp3.1", ".NETCoreApp", "v3.1", "Windows", "7.0")] // Default values pre-5.0
- [InlineData("net5.0", ".NETCoreApp", "v5.0", "Windows", "7.0")]
+ [InlineData("net5.0", ".NETCoreApp", "v5.0", "", "")]
[InlineData("net5.0-Windows7.0", ".NETCoreApp", "v5.0", "Windows", "7.0")]
[InlineData("net5.0-WINDOWS7.0", ".NETCoreApp", "v5.0", "Windows", "7.0")]
[InlineData("net5.0-windows", ".NETCoreApp", "v5.0", "Windows", "7.0")]
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
index fa8bf4ee719c..2b2a2f8b282b 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
@@ -51,7 +51,7 @@ public void It_publishes_and_runs_self_contained_wpf_app()
var publishCommand = new PublishCommand(Log, testDir.Path);
- publishCommand.Execute($"/p:RuntimeIdentifier={rid}")
+ publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:TargetPlatformIdentifier=Windows", "/p:TargetPlatformVersion=7.0")
.Should()
.Pass();
diff --git a/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionFactAttribute.cs b/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionFactAttribute.cs
index b07de809567c..86f9ede5be93 100644
--- a/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionFactAttribute.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionFactAttribute.cs
@@ -10,23 +10,7 @@ public class RequiresMSBuildVersionFactAttribute : FactAttribute
{
public RequiresMSBuildVersionFactAttribute(string version)
{
- if (TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
- {
- if (!Version.TryParse(TestContext.Current.ToolsetUnderTest.MSBuildVersion, out Version msbuildVersion))
- {
- this.Skip = $"Failed to determine the version of MSBuild ({ TestContext.Current.ToolsetUnderTest.MSBuildVersion }).";
- return;
- }
- if (!Version.TryParse(version, out Version requiredVersion))
- {
- this.Skip = $"Failed to determine the version required by this test ({ version }).";
- return;
- }
- if (requiredVersion > msbuildVersion)
- {
- this.Skip = $"This test requires MSBuild version { version } to run (using { TestContext.Current.ToolsetUnderTest.MSBuildVersion }).";
- }
- }
+ RequiresMSBuildVersionTheoryAttribute.CheckForRequiredMSBuildVersion(this, version);
}
}
}
diff --git a/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs b/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs
index 09bca5f17035..86a7178144d4 100644
--- a/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs
@@ -9,22 +9,27 @@ namespace Microsoft.NET.TestFramework
public class RequiresMSBuildVersionTheoryAttribute : TheoryAttribute
{
public RequiresMSBuildVersionTheoryAttribute(string version)
+ {
+ CheckForRequiredMSBuildVersion(this, version);
+ }
+
+ public static void CheckForRequiredMSBuildVersion(FactAttribute attribute, string version)
{
if (TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
{
if (!Version.TryParse(TestContext.Current.ToolsetUnderTest.MSBuildVersion, out Version msbuildVersion))
{
- this.Skip = $"Failed to determine the version of MSBuild ({ TestContext.Current.ToolsetUnderTest.MSBuildVersion }).";
+ attribute.Skip = $"Failed to determine the version of MSBuild ({ TestContext.Current.ToolsetUnderTest.MSBuildVersion }).";
return;
}
if (!Version.TryParse(version, out Version requiredVersion))
{
- this.Skip = $"Failed to determine the version required by this test ({ version }).";
+ attribute.Skip = $"Failed to determine the version required by this test ({ version }).";
return;
}
if (requiredVersion > msbuildVersion)
{
- this.Skip = $"This test requires MSBuild version { version } to run (using { TestContext.Current.ToolsetUnderTest.MSBuildVersion }).";
+ attribute.Skip = $"This test requires MSBuild version { version } to run (using { TestContext.Current.ToolsetUnderTest.MSBuildVersion }).";
}
}
}
diff --git a/src/Tests/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionFactAttribute.cs b/src/Tests/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionFactAttribute.cs
new file mode 100644
index 000000000000..c4fde2edb6c0
--- /dev/null
+++ b/src/Tests/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionFactAttribute.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Runtime.InteropServices;
+using Xunit;
+
+namespace Microsoft.NET.TestFramework
+{
+ public class WindowsOnlyRequiresMSBuildVersionFactAttribute : FactAttribute
+ {
+ public WindowsOnlyRequiresMSBuildVersionFactAttribute(string version)
+ {
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ this.Skip = "This test requires Windows to run";
+ }
+
+ RequiresMSBuildVersionTheoryAttribute.CheckForRequiredMSBuildVersion(this, version);
+ }
+ }
+}
diff --git a/src/Tests/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionTheoryAttribute.cs b/src/Tests/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionTheoryAttribute.cs
new file mode 100644
index 000000000000..7b8f54ea0bdb
--- /dev/null
+++ b/src/Tests/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionTheoryAttribute.cs
@@ -0,0 +1,22 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Runtime.InteropServices;
+using Xunit;
+
+namespace Microsoft.NET.TestFramework
+{
+ public class WindowsOnlyRequiresMSBuildVersionTheoryAttribute : TheoryAttribute
+ {
+ public WindowsOnlyRequiresMSBuildVersionTheoryAttribute(string version)
+ {
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ this.Skip = "This test requires Windows to run";
+ }
+
+ RequiresMSBuildVersionTheoryAttribute.CheckForRequiredMSBuildVersion(this, version);
+ }
+ }
+}