From 0f8d4a71e44d5522f47fe71f9dd25a9e4b5a0167 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 27 Oct 2022 09:55:13 -0700 Subject: [PATCH] Add warning for invalid publishsc values --- 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 +++++ src/Tasks/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 +++++ ...crosoft.NET.RuntimeIdentifierInference.targets | 5 +++++ .../GivenDotnetPublishPublishesProjects.cs | 15 +++++++++++++++ 16 files changed, 89 insertions(+) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 1b1faf9abff2..04ed47de85b9 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -875,4 +875,8 @@ You may need to build the project on another operating system or architecture, o NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported. {StrBegin="NETSDK1192: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index e93d618d3366..6695d0df3263 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Kompilace ReadyToRun se přeskočí, protože se podporuje jen pro architekturu .NET Core 3.0 a vyšší. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Publikování aplikace do jednoho souboru vyžaduje architekturu .NET Core 3.0 nebo vyšší. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 35e198b28c46..8964e78fd6ef 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Die ReadyToRun-Kompilierung wird übersprungen, weil sie nur für .NET Core 3.0 oder höher unterstützt wird. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Zum Veröffentlichen einer Anwendung in einer einzelnen Datei ist .NET Core 3.0 oder höher erforderlich. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 1131ed968991..e50b33662e4a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Se omitirá la compilación de ReadyToRun porque solo se admite para .NET Core 3.0 o versiones posteriores. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: La publicación de una aplicación en un único archivo requiere .NET Core 3.0 o versiones posteriores. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index ad677f798da7..93bb798b7bf5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: la compilation ReadyToRun va être ignorée, car elle est uniquement prise en charge pour .NET Core 3.0 ou une version ultérieure. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: la publication d'une application sur un seul fichier nécessite .NET Core 3.0 ou une version ultérieure. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index b4ded4b338b6..973cfffb0294 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: la compilazione eseguita con ReadyToRun verrà ignorata perché è supportata solo per .NET Core 3.0 o versioni successive. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: per la pubblicazione di un'applicazione in un file singolo è richiesto .NET Core 3.0 o versioni successive. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 0b60a56d09f3..b2e92f72528f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: ReadyToRun コンパイルは、.NET Core 3.0 以降でのみサポートされているため、スキップされます。 {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: アプリケーションを 1 つのファイルに発行するには、.NET Core 3.0 以降が必要です。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 5ecaffe04c53..9c4324313549 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: ReadyToRun 컴파일은 .NET Core 3.0 이상에서만 지원되므로 건너뜁니다. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: 애플리케이션을 단일 파일에 게시하려면 .NET Core 3.0 이상이 필요합니다. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index b2dab705d0f0..5ab487a42688 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Kompilacja ReadyToRun zostanie pominięta, ponieważ jest obsługiwana tylko w przypadku platformy .NET Core 3.0 lub nowszej. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Publikowanie aplikacji do pojedynczego pliku wymaga platformy .NET Core 3.0 lub nowszej. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 9ec54bd0f195..71409117b491 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: a compilação de ReadyToRun será ignorada porque ela é compatível apenas com o .NET Core 3.0 ou superior. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: a publicação de um aplicativo em um único arquivo exige o .NET Core 3.0 ou superior. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 5f422432fd96..ed15554f78ba 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: компиляция ReadyToRun будет пропущена, так как она поддерживается только для .NET Core 3.0 или более поздних версий. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: для публикации приложения в один файл требуется .NET Core 3.0 или более поздняя версия. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 4e16cdd37aa4..18f3ef251f72 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: ReadyToRun derlemesi, yalnızca .NET Core 3.0 veya üzeri için desteklendiğinden atlanacak. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Bir uygulamayı tek bir dosyada yayımlamak için .NET Core 3.0 veya üzeri gerekir. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 61d11bbbf2e7..b97f5e6a8cc3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: 将跳过 ReadyToRun 编译,因为只有 .NET Core 3.0 或更高版本才支持该编译。 {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: 将应用程序发布到单个文件需要 .NET Core 3.0 或更高版本。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index e4f292c543aa..71edc797ae70 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: 將跳過 ReadyToRun 編譯,原因是只有 .NET Core 3.0 或更高版本支援此作業。 {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: 將應用程式發行至單一檔案需使用 .NET Core 3.0 或更高版本。 diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 1c05fbe8304d..dd3284c2df61 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -192,6 +192,11 @@ Copyright (c) .NET Foundation. All rights reserved. FormatArguments="PublishAot"/> + + + diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index d845ab5d16ee..88bee5bbba12 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -202,6 +202,21 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContainProperty( publishedDirectory.Should().HaveFiles(expectedFiles); } + [Fact] + public void ItFailsWith1193IfPublishSelfContainedHasInvalidValue() + { + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld", identifier: "NET1193Failure") + .WithSource(); + + var publishCommand = new PublishCommand(testAsset); + publishCommand + .Execute("-p:PublishSelfContained=Invalid") + .Should() + .Fail() + .And.HaveStdOutContaining("NETSDK1193"); + } + [Theory] [InlineData("--sc=false")] [InlineData("--self-contained=false")]