From f36eed63127b6b64007a88c42b1f8c70094d0ef7 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Tue, 21 Jan 2025 18:59:55 +0000 Subject: [PATCH 1/5] Add error for incorrect PublishSelfContained --- src/Tasks/Common/Resources/Strings.resx | 6 +++++- 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 +++++ src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf | 5 +++++ .../targets/Microsoft.NET.Publish.targets | 6 ++++++ 15 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 527418c3a435..f05c037a821d 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -981,9 +981,13 @@ You may need to build the project on another operating system or architecture, o NETSDK1224: ASP.NET Core framework assets are not supported for the target framework. {StrBegins="NETSDK1224: "} - NETSDK1225: Native compilation is not supported when invoking the Publish target directly. Try running dotnet publish. {StrBegins="NETSDK1225: "} + + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index dab129a08c52..dfe41db45abe 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: Pokud je nastavená hodnota PublishSelfContained, musí být buď true, nebo false. Zadaná hodnota byla {0}. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 9e39c2d5bd3e..1f2930a5a7f6 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: Wenn PublishSelfContained festgelegt ist, muss es entweder "true" oder "false" sein. Der angegebene Wert war "{0}". {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 ea92a565fb71..541b83afbb9f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: si se establece PublishSelfContained, debe ser true o false. El valor dado era “{0}”. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 2ad426ab793a..972bd7ca065a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: Si PublishSelfContained est défini, il doit avoir la valeur true ou false. La valeur donnée a été '{0}'. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 1319141e2c98..017ba93fd99d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: se PublishSelfContained è impostato, deve essere true o false. Il valore specificato è '{0}'. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 2098ed8a25df..012c81572472 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: PublishSelfContained が設定されている場合、true または false のいずれかにする必要があります。指定された値は '{0}' でした。 {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 81883f27da98..800d7828c47d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: PublishSelfContained가 설정된 경우 true 또는 false여야 합니다. 지정된 값은 '{0}'입니다. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 60213f327eba..edf15dc1a86a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: Jeśli właściwość PublishSelfContained jest ustawiona, musi mieć wartość true lub false. Podana wartość to „{0}”. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 f2f9ab663c41..d83c502cc963 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: se PublishSelfContained estiver definido, ele deverá ser true ou false. O valor fornecido foi '{0} '. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 8991f7c09817..f1462a262817 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 5dd830aee234..822e065b3e2a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: PublishSelfContained ayarlanmışsa değeri true veya false olmalıdır. Verilen değer '{0}'. {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 2fd1f72f629e..80f1fc931c01 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: 如果已设置 PublishSelfContained,则它必须为 true 或 false。给定的值为“{0}”。 {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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 9085e387657e..03f876be80f8 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -806,6 +806,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1193: 如果已設定 PublishSelfContained,它必須是 True 或 False。提供的值是 '{0}'。 {StrBegins="NETSDK1193: "} + + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1126: "} + 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.Publish.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets index 6c484d0c4c16..2d2578e12de0 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets @@ -219,6 +219,12 @@ Copyright (c) .NET Foundation. All rights reserved. ResourceName="SolutionProjectConfigurationsConflict" FormatArguments="PublishRelease;$(ProjectName)"/> + + - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index dfe41db45abe..b6958a3372ee 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 1f2930a5a7f6..4acc26a6e7cd 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 541b83afbb9f..3c7ca9394bfd 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 972bd7ca065a..ccfc9d661457 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 017ba93fd99d..4fecb2837834 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 012c81572472..86c671ae9870 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 800d7828c47d..7ecf353ecae6 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index edf15dc1a86a..ad517ff5bdb9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index d83c502cc963..746bed969f0b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index f1462a262817..a6eb8a3682a3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 822e065b3e2a..5c3516041d13 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 80f1fc931c01..c0a4d9830e5c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 03f876be80f8..bdbb4733d92d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -807,9 +807,9 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1193: "} - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - NETSDK1126: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. - {StrBegins="NETSDK1126: "} + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true. + {StrBegins="NETSDK1226: "} NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs index c34806bd2fad..a32d373524fe 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs @@ -19,7 +19,8 @@ public void It_cleans_before_single_file_publish() Name = "RegularPublishToSingleExe", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "win-x86" + RuntimeIdentifier = "win-x86", + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); @@ -58,7 +59,8 @@ public void It_cleans_between_renames() Name = "PublishSingleFile1", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "win-x86" + RuntimeIdentifier = "win-x86", + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); @@ -100,7 +102,8 @@ public void It_cleans_between_single_file_publishes() Name = "PublishSingleExe", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "win-x86" + RuntimeIdentifier = "win-x86", + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); @@ -199,7 +202,7 @@ public void It_cleans_for_mvc_projects() // Publish as a single file new PublishCommand(Log, Path.Combine(testDir.Path, assetName)) - .Execute(@"/p:RuntimeIdentifier=win-x86;PublishSingleFile=true") + .Execute(@"/p:RuntimeIdentifier=win-x86;PublishSingleFile=true;SelfContained=true") .Should() .Pass(); CheckPublishOutput(publishDir, expectedSingleFiles.Append("UserData.txt"), expectedRegularFiles); @@ -214,7 +217,8 @@ public void It_cleans_with_custom_output_dir() Name = "PublishToCustomDir", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "win-x86" + RuntimeIdentifier = "win-x86", + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); @@ -249,7 +253,8 @@ public void It_cleans_with_multiple_output_dirs() Name = "PublishToMultipleDirs", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "win-x86" + RuntimeIdentifier = "win-x86", + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 6c8b823939b8..46d64fae4242 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -1575,8 +1575,9 @@ public void ILLink_can_treat_warnings_as_errors_independently(string targetFrame } [RequiresMSBuildVersionTheory("17.0.0.32901")] - [MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))] - public void ILLink_error_on_portable_app(string targetFramework) + [InlineData("net5.0")] + [InlineData("net9.0")] + public void ILLink_not_supported_error_on_portable_app(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; @@ -1590,6 +1591,22 @@ public void ILLink_error_on_portable_app(string targetFramework) .And.HaveStdOutContaining(Strings.ILLinkNotSupportedError); } + [RequiresMSBuildVersionTheory("17.0.0.32901")] + [MemberData(nameof(Net10Plus), MemberType = typeof(PublishTestUtils))] + public void ILLink_error_on_portable_app(string targetFramework) + { + var projectName = "HelloWorld"; + var referenceProjectName = "ClassLibForILLink"; + + var testProject = CreateTestProjectForILLinkTesting(_testAssetsManager, targetFramework, projectName, referenceProjectName, setSelfContained: false); + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); + + var publishCommand = new PublishCommand(testAsset); + publishCommand.Execute("/p:PublishTrimmed=true") + .Should().Fail() + .And.HaveStdOutContaining(Strings.PublishSelfContainedRequiresPublishing); + } + [RequiresMSBuildVersionTheory("17.0.0.32901")] [InlineData("net5.0")] [InlineData("netcoreapp3.1")] From ff13722bb6b3e1351216ea9242aae41bea0690b2 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Tue, 21 Jan 2025 22:23:58 +0000 Subject: [PATCH 3/5] Fix more tests --- .../GivenThatWeWantToPublishASingleFileApp.cs | 7 ++++++- .../HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs index 3dee326f2d77..36caadbc32ec 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs @@ -292,6 +292,7 @@ public void No_runtime_files() Name = "SingleFileTest", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -325,6 +326,7 @@ public void It_supports_composite_r2r(bool extractAll) Name = projName, TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -769,7 +771,8 @@ private TestProject CreateTestProjectWithAnalyzerWarnings(string targetFramework { Name = projectName, TargetFrameworks = targetFramework, - IsExe = isExecutable + IsExe = isExecutable, + SelfContained = "true" }; testProject.SourceFiles[$"{projectName}.cs"] = @" @@ -850,6 +853,7 @@ public void It_can_disable_cetcompat(bool? cetCompat) TargetFrameworks = ToolsetInfo.CurrentTargetFramework, RuntimeIdentifier = rid, IsExe = true, + SelfContained = "true" }; if (cetCompat.HasValue) { @@ -981,6 +985,7 @@ public void It_does_not_compress_single_file_by_default() Name = "SingleFileTest", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, + SelfContained = "true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject); diff --git a/test/TestAssets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj b/test/TestAssets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj index 62be58344986..2dd7fa4c8bef 100644 --- a/test/TestAssets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj +++ b/test/TestAssets/TestProjects/HelloWorldWithSubDirs/HelloWorldWithSubDirs.csproj @@ -3,6 +3,7 @@ Exe $(CurrentTargetFramework) + true From df991c626ec966d2cf827a7cd040afc672905afe Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Tue, 21 Jan 2025 23:23:23 +0000 Subject: [PATCH 4/5] Fix another test --- .../StaticWebAssetsIntegrationTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs b/test/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs index 67182d4a7908..9236a549b390 100644 --- a/test/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs +++ b/test/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs @@ -258,7 +258,7 @@ public void Publish_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPubli ProjectDirectory = CreateAspNetSdkTestAsset(testAsset); var publish = CreatePublishCommand(ProjectDirectory); - ExecuteCommand(publish, "/p:PublishSingleFile=true", $"/p:RuntimeIdentifier={RuntimeInformation.RuntimeIdentifier}").Should().Pass(); + ExecuteCommand(publish, "/p:PublishSingleFile=true", "/p:SelfContained=true", $"/p:RuntimeIdentifier={RuntimeInformation.RuntimeIdentifier}").Should().Pass(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug", RuntimeInformation.RuntimeIdentifier).ToString(); var publishPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -776,7 +776,7 @@ public void PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonM ExecuteCommand(restore).Should().Pass(); var publish = CreatePublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); - ExecuteCommand(publish, "/p:PublishSingleFile=true", $"/p:RuntimeIdentifier={RuntimeInformation.RuntimeIdentifier}").Should().Pass(); + ExecuteCommand(publish, "/p:PublishSingleFile=true", "/p:SelfContained=true", $"/p:RuntimeIdentifier={RuntimeInformation.RuntimeIdentifier}").Should().Pass(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug", RuntimeInformation.RuntimeIdentifier).ToString(); var publishPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); From d8d07d909844713cf7c7b0519278f66c839aafee Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 22 Jan 2025 19:55:27 +0000 Subject: [PATCH 5/5] Fix test --- .../GivenThatWeWantToPublishASingleFileLibrary.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileLibrary.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileLibrary.cs index 1170a6a13861..b8e31d7ef35f 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileLibrary.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileLibrary.cs @@ -24,7 +24,8 @@ public void ItPublishesSuccessfullyWithRIDAndPublishSingleFileLibrary() TestProject testProject = new("MainProject") { TargetFrameworks = targetFramework, - IsExe = true + IsExe = true, + SelfContained = "true" }; testProject.ReferencedProjects.Add(referencedProject); testProject.RecordProperties("RuntimeIdentifier");