From af874f022d2dc82c68ad313093b5326aee7bda59 Mon Sep 17 00:00:00 2001 From: Sarah Oslund Date: Fri, 17 Jul 2020 13:53:36 -0700 Subject: [PATCH 1/2] Error on unsupported Windows TargetPlatformVersion --- src/Tasks/Common/Resources/Strings.resx | 4 +++ src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.de.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.es.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.it.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 5 ++++ .../Common/Resources/xlf/Strings.pt-BR.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 5 ++++ src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 5 ++++ .../Common/Resources/xlf/Strings.zh-Hans.xlf | 5 ++++ .../Common/Resources/xlf/Strings.zh-Hant.xlf | 5 ++++ .../Microsoft.NET.Sdk.BeforeCommon.targets | 1 + .../targets/Microsoft.NET.Sdk.props | 3 +++ ...crosoft.NET.SupportedTargetPlatforms.props | 26 +++++++++++++++++++ .../targets/Microsoft.NET.Windows.targets | 12 +++++++++ .../GivenThatWeWantToBuildALibrary.cs | 4 +-- ...ThatWeWantToBuildAWindowsDesktopProject.cs | 21 +++++++++++++++ 20 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetPlatforms.props diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index e6c8dc85e9a4..e77c8b3b5806 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -653,4 +653,8 @@ The following are names of parameters or literal values and should not be transl NETSDK1137: It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Microsoft.NET.Sdk can be used instead. {StrBegin="NETSDK1137: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 803ffeca50aa..61d25545111d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 f4477e505c1c..e51f787990a3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 e608cbae9852..bcdd755feccd 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 64ae2d07a01a..0408bf23c0c1 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 e1718c7e5309..d5f2e8d40a34 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 04c61f5eb2f4..4249dbb22c6e 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -395,6 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: ロールフォワード値 '{0}' が無効です。許可されている値は {1} です。 {StrBegin="NETSDK1104: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 1f390807feaf..cc87632e018c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -395,6 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: RollForward 값 '{0}'이(가) 잘못되었습니다. 허용되는 값은 {1}입니다. {StrBegin="NETSDK1104: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 1ab444365d29..ac108e62a966 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 5d1f8fc295a3..d71abe77fec5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 be3856391b6c..e5dcb7bf6121 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -395,6 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: недопустимое значение RollForward "{0}". Разрешенные значения — {1}. {StrBegin="NETSDK1104: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 c12ae3fdc98f..a98adcb2ff28 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -395,6 +395,11 @@ 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: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 3b6407cd29b9..59929410e875 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -395,6 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: RollForward 值“{0}”无效。允许的值为 {1}。 {StrBegin="NETSDK1104: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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 2b561ccacf47..3d84802aa4a3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -395,6 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: RollForward 值 '{0}' 無效。允許的值為 {1}。 {StrBegin="NETSDK1104: "} + + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + {StrBegin="NETSDK1138: "} + 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..ad4e68e5d284 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.SupportedTargetPlatforms.props b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetPlatforms.props new file mode 100644 index 000000000000..5b76d8d337ce --- /dev/null +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetPlatforms.props @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index 9a7a9901b0f2..43b09a23545e 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -24,4 +24,16 @@ Copyright (c) .NET Foundation. All rights reserved. 7.0 + + + + + + + + diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs index 9aaf76ed23ba..ffaa596d4c8e 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs @@ -423,7 +423,7 @@ public void It_implicitly_defines_compilation_constants_for_the_target_framework [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"; @@ -452,7 +452,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"; diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs index b8c88e411d37..2a8e091af7be 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs @@ -101,5 +101,26 @@ public void It_warns_when_specifying_windows_desktop_sdk() .And .HaveStdOutContaining("NETSDK1137"); } + + [WindowsOnlyFact] + public void It_fails_if_windows_target_platform_version_is_invalid() + { + var testProject = new TestProject() + { + Name = "InvalidWindowsVersion", + IsSdkProject = true, + TargetFrameworks = "net5.0" + }; + testProject.AdditionalProperties["TargetPlatformIdentifier"] = "Windows"; + testProject.AdditionalProperties["TargetPlatformVersion"] = "1.0"; + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Fail() + .And + .HaveStdOutContaining("NETSDK1138"); + } } } From 42a8f90b9dd3f3b2d6fc60f432ae4b137614bd49 Mon Sep 17 00:00:00 2001 From: Sarah Oslund Date: Tue, 21 Jul 2020 08:48:38 -0700 Subject: [PATCH 2/2] PR feedback --- src/Tasks/Common/Resources/Strings.resx | 5 +++-- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 8 +++++--- .../Common/Resources/xlf/Strings.pt-BR.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 8 +++++--- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 8 +++++--- .../Common/Resources/xlf/Strings.zh-Hans.xlf | 8 +++++--- .../Common/Resources/xlf/Strings.zh-Hant.xlf | 8 +++++--- .../Microsoft.NET.Sdk.BeforeCommon.targets | 2 +- .../targets/Microsoft.NET.Sdk.props | 4 ++-- ...rosoft.NET.TargetFrameworkInference.targets | 18 ++++++++++++++++++ .../targets/Microsoft.NET.Windows.targets | 12 ------------ ....NET.WindowsSupportedTargetPlatforms.props} | 4 ++-- ...eWantToBuildALibraryWithOSMinimumVersion.cs | 2 ++ 20 files changed, 93 insertions(+), 58 deletions(-) rename src/Tasks/Microsoft.NET.Build.Tasks/targets/{Microsoft.NET.SupportedTargetPlatforms.props => Microsoft.NET.WindowsSupportedTargetPlatforms.props} (86%) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index e77c8b3b5806..1c110a4f53b5 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -653,8 +653,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1137: It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Microsoft.NET.Sdk can be used instead. {StrBegin="NETSDK1137: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 61d25545111d..f7b34a3d178b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index e51f787990a3..d4cb3d5c0d26 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index bcdd755feccd..aa75fe38b925 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 0408bf23c0c1..e1dd5a1fd271 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index d5f2e8d40a34..d05ccd956297 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 4249dbb22c6e..eb959ca3aa75 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -395,9 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: ロールフォワード値 '{0}' が無効です。許可されている値は {1} です。 {StrBegin="NETSDK1104: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index cc87632e018c..750ae8d5170f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -395,9 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: RollForward 값 '{0}'이(가) 잘못되었습니다. 허용되는 값은 {1}입니다. {StrBegin="NETSDK1104: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index ac108e62a966..ef43642af0a6 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index d71abe77fec5..f00691f89a2a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index e5dcb7bf6121..b21aa304c3b0 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -395,9 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: недопустимое значение RollForward "{0}". Разрешенные значения — {1}. {StrBegin="NETSDK1104: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index a98adcb2ff28..86ba2e9bef24 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -395,9 +395,11 @@ 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: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 59929410e875..f33926eec583 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -395,9 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: RollForward 值“{0}”无效。允许的值为 {1}。 {StrBegin="NETSDK1104: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 3d84802aa4a3..9e3a1b2b11b0 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -395,9 +395,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1104: RollForward 值 '{0}' 無效。允許的值為 {1}。 {StrBegin="NETSDK1104: "} - - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. - NETSDK1138: {0} is not a valid Windows TargetPlatformVersion. + + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1138: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} {StrBegin="NETSDK1138: "} 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 ad4e68e5d284..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,7 +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 d6c8cb76c293..4e7947834224 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 @@ -193,6 +193,24 @@ Copyright (c) .NET Foundation. All rights reserved. FormatArguments="$(MinimumOSPlatform);$(TargetPlatformVersion)"/> + + + + + + + true + @(SupportedTargetPlatform, ', ') + None + + + + + - + diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs index 4787d3170f71..045b1f3d53a6 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs @@ -40,6 +40,7 @@ public void WhenPropertiesAreSetItCanGenerateMinimumOSPlatformAttribute() testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier; testProject.AdditionalProperties["MinimumOSPlatform"] = "13.2"; testProject.AdditionalProperties["TargetPlatformVersion"] = "14.0"; + testProject.AdditionalProperties["TargetPlatformVersionSupported"] = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -58,6 +59,7 @@ public void WhenMinimumOSPlatformISNotSetTargetPlatformVersionIsSetItCanGenerate var targetPlatformIdentifier = "iOS"; testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier; testProject.AdditionalProperties["TargetPlatformVersion"] = "13.2"; + testProject.AdditionalProperties["TargetPlatformVersionSupported"] = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject);