From 8bce0b67cd9f9dc0509d56a279a94b7250bec5f4 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 19 Jan 2023 17:00:29 -0800 Subject: [PATCH 01/60] Make the breaking change of RID -> No Longer -> SC --- src/Tasks/Common/Resources/Strings.resx | 4 + ...oft.NET.RuntimeIdentifierInference.targets | 13 +++- ...GivenThatWeWantToBuildASelfContainedApp.cs | 75 +++++++++++++++++++ 3 files changed, 89 insertions(+), 3 deletions(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index d4fc63f0c196..4e7216b894e6 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -891,4 +891,8 @@ You may need to build the project on another operating system or architecture, o NETSDK1196: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false. {StrBegin="NETSDK1196: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + 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 73c6643b6053..3bde13f8bf9d 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 @@ -149,7 +149,9 @@ Copyright (c) .NET Foundation. All rights reserved. <_SelfContainedWasSpecified Condition="'$(SelfContained)' != ''">true - true + + true false <_RuntimeIdentifierUsesAppHost Condition="$(RuntimeIdentifier.StartsWith('ios')) or $(RuntimeIdentifier.StartsWith('tvos')) or $(RuntimeIdentifier.StartsWith('maccatalyst')) or $(RuntimeIdentifier.StartsWith('android')) or $(RuntimeIdentifier.StartsWith('browser'))">false <_RuntimeIdentifierUsesAppHost Condition="'$(_RuntimeIdentifierUsesAppHost)' == ''">true @@ -222,10 +224,15 @@ Copyright (c) .NET Foundation. All rights reserved. because we do not want the behavior to be a breaking change compared to version 3.0 --> + ResourceName="PublishReadyToRunRequiresVersion30" /> + ResourceName="PublishTrimmedRequiresVersion30" /> + + + + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); + }); + + var buildCommand = new BuildCommand(testAsset); + buildCommand + .Execute() + .Should() + .Pass(); + + var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier); + var selfContainedExecutable = $"HelloWorld{Constants.ExeSuffix}"; + string selfContainedExecutableFullPath = Path.Combine(outputDirectory.FullName, selfContainedExecutable); + + if (targetFramework == "net7.0") + { + Assert.True(File.Exists(selfContainedExecutableFullPath)); + } + else + { + Assert.False(File.Exists(selfContainedExecutableFullPath)); // RuntimeIdentifier no longer implies SelfContained for TFM >= 8 + } + } + + [Theory] + [InlineData("net7.0", true)] + [InlineData("net7.0", false)] + [InlineData("net8.0", false)] + public void It_does_or_doesnt_warn_based_on_SelfContained_and_TargetFramework_breaking_RID_change(string targetFramework, bool defineSelfContained) + { + var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework); + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld", identifier: targetFramework + defineSelfContained.ToString()) + .WithSource() + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); + propertyGroup.Add(new XElement(ns + "SelfContained", defineSelfContained ? "true" : "")); + }); + + var buildCommand = new BuildCommand(testAsset); + var commandResult = buildCommand.Execute(); + + if (targetFramework == "net7.0" && !defineSelfContained) + { + commandResult + .Should() + .Pass() + .And + .HaveStdOutContaining(Strings.RuntimeIdentifierWillNoLongerImplySelfContained); + } + else + { + commandResult + .Should() + .Pass() + .And + .NotHaveStdOutContaining(Strings.RuntimeIdentifierWillNoLongerImplySelfContained); + } + } + [Fact] public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_true() { From ee5d5680e3cfdf517535b9e11109c0aa3cdad723 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 20 Jan 2023 09:32:47 -0800 Subject: [PATCH 02/60] Update XLF and remove breaking change error. --- 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.Sdk.targets | 12 ++---------- 14 files changed, 67 insertions(+), 10 deletions(-) diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 11585cef5963..77bb642d78f8 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: Zadejte parametr RuntimeIdentifier. {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: Soubor seznamu modulu runtime {0} nebyl nalezen. Tady můžete tuto chybu nahlásit týmu .NET: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index c176574eea28..f0f0aec1e013 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: Geben Sie einen RuntimeIdentifier an. {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: Die Runtimelistendatei "{0}" wurde nicht gefunden. Melden Sie diesen Fehler hier dem .NET-Team: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index c3aabf395334..b2458f688168 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: Especificar un valor para RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: No se encontró el archivo de lista del entorno de ejecución "{0}". Notifique este error al equipo de .NET aquí: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index c3f74ce99491..bead9ee98c25 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: Spécifiez un RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: Le fichier de liste de runtime '{0}' est introuvable. Signalez cette erreur à l'équipe .NET ici : https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 637ab5e4cd64..03b142fd3fb2 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: specificare un elemento RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: il file di elenco di runtime '{0}' non è stato trovato. Segnalare questo errore al team di .NET all'indirizzo: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 9e15fee67346..8613b11c4d1f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: RuntimeIdentifier の指定 {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: ランタイム リスト ファイル '{0}' が見つかりませんでした。https://aka.ms/dotnet-sdk-issue で、このエラーを .NET チームに報告してください。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 79fe7d91657d..0a024764e113 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: RuntimeIdentifier 지정 {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: 런타임 목록 파일 '{0}'을(를) 찾을 수 없습니다. https://aka.ms/dotnet-sdk-issue에서 .NET 팀에 이 오류를 보고하세요. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index b268f98ecab5..9ea51ae98f86 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: Określ element RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: Nie odnaleziono pliku listy środowiska uruchomieniowego „{0}”. Zgłoś ten błąd zespołowi platformy .NET tutaj: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index dd9f4f289868..dfe544dde603 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: Especifique um RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: o arquivo da lista de runtime '{0}' não foi encontrado. Relate esse erro à equipe do .NET aqui: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 08d12bcf627e..7e61b8bb59c6 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: укажите RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: не найден файл списка среды выполнения "{0}". Сообщите об этой ошибке группе разработчиков .NET по следующему адресу: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index e15f42abefb9..c140094bd745 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: Bir RuntimeIdentifier belirtin {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: '{0}' çalışma zamanı listesi dosyası bulunamadı. Bu hatayı https://aka.ms/dotnet-sdk-issue adresinden .NET ekibine bildirin. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 884bbf42c945..357ca0ad8ef3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: 指定一个 RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: 找不到运行时列表文件“{0}”。请在此处将此错误报告给 .NET 团队: https://aka.ms/dotnet-sdk-issue。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index ef0ff2beed55..524342da4fed 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -790,6 +790,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1028: 指定 RuntimeIdentifier {StrBegin="NETSDK1028: "} + + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: In projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To preserve a project's current behavior after upgrading to 8.0, consider setting SelfContained explicitly. + {StrBegin="NETSDK1198: "} + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. NETSDK1109: 找不到執行階段清單檔案 '{0}'。請將此錯誤回報給 .NET 小組: https://aka.ms/dotnet-sdk-issue。 diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets index e069faa4289f..94e811f96231 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets @@ -1097,7 +1097,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + false @@ -1143,15 +1143,7 @@ Copyright (c) .NET Foundation. All rights reserved. - - - + - From 61c2c329b49981a256a5d9aa23d815082a20003a Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 20 Jan 2023 11:51:35 -0800 Subject: [PATCH 04/60] Fix a test which did not properly check if app was SelfContained or not Update ILLink Tests to use SelfContained explicitly Repair Publish* Tests that will be broken and now need to add SC Update publish trimmed test to expect self contained to be explicitly specified Update Publish* related tests to add SC PublishSingleFile test adds SC now IL Link and Publish* Tests now add SelfContained where a RuntimeIdentifier used to infer it automaticall per .NET 8 breaking change --- .../GivenThatWeWantToBuildANetCoreApp.cs | 1 + ...GivenThatWeWantToBuildASelfContainedApp.cs | 37 ++--- .../ReferenceExeTests.cs | 6 +- ...enThatWeWantToPublishAHelloWorldProject.cs | 2 +- ...tWeWantToPublishANetCoreAppForTelemetry.cs | 2 + ...venThatWeWantToPublishASelfContainedApp.cs | 4 +- .../GivenThatWeWantToPublishASingleFileApp.cs | 4 +- .../GivenThatWeWantToPublishIncrementally.cs | 1 + .../GivenThatWeWantToPublishReadyToRun.cs | 1 + .../GivenThatWeWantToRunILLink.cs | 154 +++++++++--------- .../PublishTests.cs | 1 + ...atWeWantToPackAToolSelfContainedProject.cs | 4 +- 12 files changed, 112 insertions(+), 105 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index 8c239e4ada92..57df446a5a38 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs @@ -822,6 +822,7 @@ public void It_regenerates_files_if_self_contained_changes() IsExe = true }; + testProject.AdditionalProperties["SelfContained"] = "true"; var testAsset = _testAssetsManager .CreateTestProject(testProject); diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 268b248a71d3..3799d4ae3ca0 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -389,34 +389,29 @@ public void It_can_publish_runtime_specific_apps_with_library_dependencies_self_ public void It_does_or_doesnt_imply_SelfContained_based_on_RuntimeIdentifier_and_TargetFramework(string targetFramework) { var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework); - var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld", identifier: targetFramework) - .WithSource() - .WithProjectChanges(project => - { - var ns = project.Root.Name.Namespace; - var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); - }); + bool resultShouldBeSelfContained = targetFramework == "net7.0" ? true : false; + var testProject = new TestProject("MainProject") + { + TargetFrameworks = targetFramework, + IsExe = true + }; - var buildCommand = new BuildCommand(testAsset); - buildCommand + testProject.RecordProperties("SelfContained"); + testProject.AdditionalProperties["RuntimeIdentifier"] = runtimeIdentifier; + + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); + new DotnetBuildCommand(Log) + .WithWorkingDirectory(Path.Combine(testAsset.Path, "MainProject")) .Execute() .Should() .Pass(); - var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier); - var selfContainedExecutable = $"HelloWorld{Constants.ExeSuffix}"; - string selfContainedExecutableFullPath = Path.Combine(outputDirectory.FullName, selfContainedExecutable); - - if (targetFramework == "net7.0") + var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: targetFramework); + if (resultShouldBeSelfContained) { - Assert.True(File.Exists(selfContainedExecutableFullPath)); - } - else - { - Assert.False(File.Exists(selfContainedExecutableFullPath)); // RuntimeIdentifier no longer implies SelfContained for TFM >= 8 + Assert.True(bool.Parse(properties["SelfContained"]) == resultShouldBeSelfContained); } + } [Theory] diff --git a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs index 79031d63a8f1..54d80ac90fd6 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs @@ -77,6 +77,7 @@ private void CreateProjects() if (MainSelfContained) { MainProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(); + MainProject.AdditionalProperties["SelfContained"] = "true"; } ReferencedProject = new TestProject() @@ -90,6 +91,7 @@ private void CreateProjects() if (ReferencedSelfContained) { ReferencedProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(); + ReferencedProject.AdditionalProperties["SelfContained"] = "true"; } // Use a lower version of a library in the referenced project @@ -296,8 +298,8 @@ public void ReferencedExeCanRunWhenPublishedWithTrimming(bool referenceExeInCode CreateProjects(); RunTest(callingMethod: System.Reflection.MethodBase.GetCurrentMethod().ToString() - .Replace("Void ","") - .Replace("Boolean",referenceExeInCode.ToString())); + .Replace("Void ", "") + .Replace("Boolean", referenceExeInCode.ToString())); } [RequiresMSBuildVersionTheory("17.0.0.32901")] diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs index 2a2b998bc84c..e2a81de3497f 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs @@ -88,7 +88,7 @@ public void It_publishes_self_contained_apps_to_the_publish_folder_and_the_app_s .WithTargetFramework(targetFramework); var publishCommand = new PublishCommand(helloWorldAsset); - var publishResult = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:CopyLocalLockFileAssemblies=true"); + var publishResult = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:CopyLocalLockFileAssemblies=true"); publishResult.Should().Pass(); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishANetCoreAppForTelemetry.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishANetCoreAppForTelemetry.cs index 55ad412e64af..df31e2b8872f 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishANetCoreAppForTelemetry.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishANetCoreAppForTelemetry.cs @@ -26,6 +26,7 @@ public void It_collects_empty_Trimmer_SingleFile_ReadyToRun_Aot_publishing_prope Type loggerType = typeof(LogTelemetryToStdOutForTest); var TelemetryTestLogger = new[] { + "--property:SelfContained=true", $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" }; @@ -43,6 +44,7 @@ public void It_collects_Trimmer_SingleFile_ReadyToRun_publishing_properties(stri Type loggerType = typeof(LogTelemetryToStdOutForTest); var TelemetryTestLogger = new[] { + "--property:SelfContained=true", $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" }; diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs index 6ef5bcdfe3ce..93b651036096 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs @@ -154,7 +154,7 @@ public void It_publishes_runtime_pack_resources() var command = new PublishCommand(testProjectInstance); command - .Execute($"/p:RuntimeIdentifier={rid}") + .Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should() .Pass(); @@ -199,7 +199,7 @@ public void It_publishes_runtime_pack_resources_for_specific_languages() var command = new PublishCommand(testProjectInstance); command - .Execute($"/p:RuntimeIdentifier={rid}") + .Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should() .Pass(); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs index 29d3464e072e..908ee9f31d16 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs @@ -794,7 +794,7 @@ public void It_compresses_single_file_as_directed() var singleFilePath = Path.Combine(GetPublishDirectory(publishCommand, ToolsetInfo.CurrentTargetFramework).FullName, $"SingleFileTest{Constants.ExeSuffix}"); publishCommand - .Execute(PublishSingleFile, RuntimeIdentifier, IncludeNative, "/p:EnableCompressionInSingleFile=false") + .Execute(PublishSingleFile, RuntimeIdentifier, IncludeNative, "/p:SelfContained=true", "/p:EnableCompressionInSingleFile=false") .Should() .Pass(); var uncompressedSize = new FileInfo(singleFilePath).Length; @@ -802,7 +802,7 @@ public void It_compresses_single_file_as_directed() WaitForUtcNowToAdvance(); publishCommand - .Execute(PublishSingleFile, RuntimeIdentifier, IncludeNative, "/p:EnableCompressionInSingleFile=true") + .Execute(PublishSingleFile, RuntimeIdentifier, IncludeNative, "/p:SelfContained=true", "/p:EnableCompressionInSingleFile=true") .Should() .Pass(); var compressedSize = new FileInfo(singleFilePath).Length; diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs index 19fcfd76ea37..da8b7a6ff68b 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs @@ -137,6 +137,7 @@ public void It_cleans_before_trimmed_single_file_publish() RuntimeIdentifier = "win-x86" }; testProject.AdditionalProperties["PublishTrimmed"] = "true"; + testProject.AdditionalProperties["SelfContained"] = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); var publishDir = Path.Combine(testAsset.TestRoot, testProject.Name, "bin", "Debug", testProject.TargetFrameworks, testProject.RuntimeIdentifier, "publish"); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs index c718957eafbd..8533180a8737 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs @@ -67,6 +67,7 @@ public void It_creates_readytorun_images_for_all_assemblies_except_excluded_ones "ClassLib"); testProject.AdditionalProperties["PublishReadyToRun"] = "True"; + testProject.AdditionalProperties["SelfContained"] = "True"; testProject.AddItem("PublishReadyToRunExclude", "Include", "Classlib.dll"); var testProjectInstance = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 395c522f98b9..e984f230652a 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -45,7 +45,7 @@ public void ILLink_only_runs_when_switch_is_enabled(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -83,7 +83,7 @@ public void ILLink_runs_and_creates_linked_app(string targetFramework, bool refe .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -121,7 +121,7 @@ public void ILLink_links_simple_app_without_analysis_warnings_and_it_runs(string var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework + trimMode); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", $"/p:TrimMode={trimMode}", "/p:SuppressTrimAnalysisWarnings=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:TrimMode={trimMode}", "/p:SuppressTrimAnalysisWarnings=true") .Should().Pass() .And.NotHaveStdOutContaining("warning IL2075") .And.NotHaveStdOutContaining("warning IL2026"); @@ -146,7 +146,8 @@ public void ILLink_fails_when_no_matching_pack_is_found(string targetFramework) var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName); var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework) - .WithProjectChanges(project => { + .WithProjectChanges(project => + { var ns = project.Root.Name.Namespace; project.Root.Add(new XElement(ns + "ItemGroup", new XElement("KnownILLinkPack", @@ -154,7 +155,7 @@ public void ILLink_fails_when_no_matching_pack_is_found(string targetFramework) }); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true") .Should().Fail() .And.HaveStdOutContaining("error NETSDK1195"); } @@ -172,7 +173,7 @@ public void PrepareForILLink_can_set_IsTrimmable(string targetFramework) .WithProjectChanges(project => SetMetadata(project, referenceProjectName, "IsTrimmable", "True")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -197,7 +198,7 @@ public void PrepareForILLink_can_set_TrimMode(string targetFramework) .WithProjectChanges(project => SetMetadata(project, referenceProjectName, "TrimMode", "link")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -229,7 +230,7 @@ public void ILLink_respects_global_TrimMode(string targetFramework, string trimM .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -264,7 +265,7 @@ public void ILLink_roots_IntermediateAssembly(string targetFramework) .WithProjectChanges(project => SetMetadata(project, projectName, "IsTrimmable", "True")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -288,7 +289,7 @@ public void ILLink_respects_TrimmableAssembly(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -311,7 +312,7 @@ public void ILLink_respects_IsTrimmable_attribute(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -345,7 +346,7 @@ public void ILLink_IsTrimmable_metadata_can_override_attribute(string targetFram .WithProjectChanges(project => SetMetadata(project, "UnusedNonTrimmableAssembly", "IsTrimmable", "true")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/v:n").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/v:n").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -368,7 +369,7 @@ public void ILLink_TrimMode_applies_to_IsTrimmable_assemblies(string targetFrame var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -398,7 +399,7 @@ public void ILLink_TrimMode_new_options(string targetFramework, string trimMode) .WithProjectChanges(project => SetGlobalTrimMode(project, trimMode)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "-bl").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "-bl").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -438,7 +439,7 @@ public void ILLink_can_set_TrimmerDefaultAction(string targetFramework) .WithProjectChanges(project => SetTrimmerDefaultAction(project, "link")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -467,7 +468,7 @@ public void ILLink_analysis_warnings_are_disabled_by_default(string targetFramew var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass() // trim analysis warnings are disabled .And.NotHaveStdOutMatching(@"warning IL\d\d\d\d"); @@ -485,7 +486,7 @@ public void ILLink_analysis_warnings_are_enabled_by_default(string targetFramewo var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass() // trim analysis warnings are enabled .And.HaveStdOutMatching("warning IL2075.*Program.IL_2075") @@ -508,7 +509,7 @@ public void ILLink_accepts_option_to_enable_analysis_warnings(string targetFrame var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass() .And.HaveStdOutMatching("warning IL2075.*Program.IL_2075") .And.HaveStdOutMatching("warning IL2026.*Program.IL_2026.*Testing analysis warning IL2026") @@ -530,7 +531,7 @@ public void ILLink_accepts_option_to_disable_analysis_warnings(string targetFram var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass() .And.NotHaveStdOutContaining("warning IL2075") .And.NotHaveStdOutContaining("warning IL2026") @@ -552,7 +553,7 @@ public void ILLink_accepts_option_to_enable_analysis_warnings_without_PublishTri var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass() .And.HaveStdOutMatching("warning IL2026.*Program.IL_2026.*Testing analysis warning IL2026"); } @@ -568,7 +569,7 @@ public void ILLink_shows_single_warning_for_packagereferences_only(string target .WithSource(); var publishCommand = new PublishCommand(testAsset, "App"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass() .And.HaveStdOutMatching("IL2026: App.Program.Main.*Program.RUC") .And.HaveStdOutMatching("IL2026: ProjectReference.ProjectReferenceLib.Method.*ProjectReferenceLib.RUC") @@ -591,7 +592,7 @@ public void ILLink_accepts_option_to_show_all_warnings(string targetFramework) .WithSource(); var publishCommand = new PublishCommand(testAsset, "App"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:TrimmerSingleWarn=false") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:TrimmerSingleWarn=false") .Should().Pass() .And.HaveStdOutMatching("IL2026: App.Program.Main.*Program.RUC") .And.HaveStdOutMatching("IL2026: ProjectReference.ProjectReferenceLib.Method.*ProjectReferenceLib.RUC") @@ -617,7 +618,7 @@ public void ILLink_can_show_single_warning_per_assembly(string targetFramework) }); var publishCommand = new PublishCommand(testAsset, "App"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:TrimmerSingleWarn=false") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:TrimmerSingleWarn=false") .Should().Pass() .And.NotHaveStdOutMatching("IL2026: App.Program.Main.*Program.RUC") .And.NotHaveStdOutMatching("IL2026: ProjectReference.ProjectReferenceLib.Method.*ProjectReferenceLib.RUC") @@ -649,7 +650,7 @@ public void ILLink_errors_fail_the_build(string targetFramework) .WithProjectChanges(project => AddRootDescriptor(project, $"{projectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false") .Should().Fail() .And.HaveStdOutContaining("error IL1001") .And.HaveStdOutContaining(Strings.ILLinkFailed); @@ -682,28 +683,29 @@ public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_copyused(s "ILLink : Trim analysis warning IL2063: System.RuntimeType.GetInterface(String, Boolean", "ILLink : Trim analysis warning IL2065: System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(Type", }; - switch (targetFramework) { - case "net6.0": - expectedOutput.AddRange(new string[] { + switch (targetFramework) + { + case "net6.0": + expectedOutput.AddRange(new string[] { "ILLink : Trim analysis warning IL2026: Internal.Runtime.InteropServices.InMemoryAssemblyLoader.LoadInMemoryAssembly(IntPtr, IntPtr", }); - break; - case "net7.0": - case "net8.0": - expectedOutput.AddRange(new string[] { + break; + case "net7.0": + case "net8.0": + expectedOutput.AddRange(new string[] { "ILLink : Trim analysis warning IL2026: Internal.Runtime.InteropServices.InMemoryAssemblyLoader.LoadInMemoryAssembly(IntPtr, IntPtr", "ILLink : Trim analysis warning IL2026: Internal.Runtime.InteropServices.InMemoryAssemblyLoader.LoadInMemoryAssemblyInContextWhenSupported(IntPtr, IntPtr", }); - break; - default: - throw new InvalidOperationException(); + break; + default: + throw new InvalidOperationException(); } var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName); var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimMode=copyused", "/p:TrimmerSingleWarn=false"); + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimMode=copyused", "/p:TrimmerSingleWarn=false"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, expectedOutput.ToArray(), targetFramework, rid); } @@ -729,17 +731,18 @@ public void ILLink_verify_analysis_warnings_framework_assemblies(string targetFr "ILLink : Trim analysis warning IL2026: System.Resources.ManifestBasedResourceGroveler.CreateResourceSet(Stream, Assembly", "ILLink : Trim analysis warning IL2026: System.StartupHookProvider.ProcessStartupHooks(", }; - switch (targetFramework) { - case "net6.0": - expectedOutput.AddRange(new string[] { + switch (targetFramework) + { + case "net6.0": + expectedOutput.AddRange(new string[] { "ILLink : Trim analysis warning IL2026: Internal.Runtime.InteropServices.InMemoryAssemblyLoader.LoadInMemoryAssembly(IntPtr, IntPtr", "ILLink : Trim analysis warning IL2055: System.Runtime.Serialization.ClassDataContract.UnadaptedClassType.get", "ILLink : Trim analysis warning IL2067: System.Runtime.Serialization.SurrogateDataContract.GetUninitializedObject(Type" }); - break; - case "net7.0": - case "net8.0": - expectedOutput.AddRange(new string[] { + break; + case "net7.0": + case "net8.0": + expectedOutput.AddRange(new string[] { "ILLink : Trim analysis warning IL2026: Internal.Runtime.InteropServices.ComActivator.GetClassFactoryForTypeInternal(ComActivationContextInternal*", "ILLink : Trim analysis warning IL2026: Internal.Runtime.InteropServices.InMemoryAssemblyLoader.LoadInMemoryAssembly(IntPtr, IntPtr", "ILLink : Trim analysis warning IL2026: Internal.Runtime.InteropServices.InMemoryAssemblyLoader.LoadInMemoryAssemblyInContextWhenSupported(IntPtr, IntPtr", @@ -752,16 +755,16 @@ public void ILLink_verify_analysis_warnings_framework_assemblies(string targetFr "ILLink : Trim analysis warning IL2045: System.Runtime.InteropServices.ComAwareEventInfo.GetDataForComInvocation(EventInfo, Guid&, Int32&", "ILLink : Trim analysis warning IL2045: System.Runtime.InteropServices.ComAwareEventInfo.GetDataForComInvocation(EventInfo, Guid&, Int32&" }); - break; - default: - throw new InvalidOperationException(); + break; + default: + throw new InvalidOperationException(); } var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName); var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimMode=copy", "/p:_TrimmerDefaultAction=copy", "/p:TrimmerSingleWarn=false"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, expectedOutput.ToArray(), targetFramework, rid); @@ -778,7 +781,7 @@ public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_link(strin var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false"); + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, Array.Empty(), targetFramework, rid); } @@ -794,7 +797,7 @@ public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_link_5_0() var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false", + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false", "/p:TrimMode=link"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, Array.Empty(), targetFramework, rid); @@ -844,7 +847,7 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: projectName + targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true") .Should().Pass(); string outputDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -914,7 +917,7 @@ public void ILLink_accepts_root_descriptor(string targetFramework) // check whether the root descriptor actually roots only // the specified method. var extraArgs = $"--action link {referenceProjectName}"; - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:_ExtraTrimmerArgs={extraArgs}", "/v:n").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -945,7 +948,7 @@ public void ILLink_error_on_nonboolean_optimization_flag(string property) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: property); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", $"/p:{property}=NonBool") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:{property}=NonBool") .Should().Fail().And.HaveStdOutContaining("MSB4030"); } @@ -969,7 +972,7 @@ public void ILLink_respects_feature_settings_from_host_config() .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:_ExtraTrimmerArgs=--action link {referenceProjectName}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1002,7 +1005,7 @@ public void ILLink_ignores_host_config_settings_with_link_false() .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:_ExtraTrimmerArgs=--action link {referenceProjectName}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1033,12 +1036,12 @@ public void ILLink_runs_incrementally(string targetFramework) var linkSemaphore = Path.Combine(intermediateLinkDir, "Link.semaphore"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreFirstModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); WaitForUtcNowToAdvance(); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreSecondModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); semaphoreFirstModifiedTime.Should().Be(semaphoreSecondModifiedTime); @@ -1058,7 +1061,7 @@ public void ILLink_old_defaults_keep_nonframework(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1094,7 +1097,7 @@ public void ILLink_net7_defaults_trim_nonframework() var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1141,7 +1144,7 @@ public void ILLink_does_not_include_leftover_artifacts_on_second_run(string targ var linkSemaphore = Path.Combine(intermediateLinkDir, "Link.semaphore"); // Link, keeping classlib - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreFirstModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); var publishedDllKeptFirstTimeOnly = Path.Combine(publishDirectory, $"{referenceProjectName}.dll"); @@ -1158,7 +1161,7 @@ public void ILLink_does_not_include_leftover_artifacts_on_second_run(string targ testAsset = testAsset.WithProjectChanges(project => RemoveRootDescriptor(project)); // Link, discarding classlib - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreSecondModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); // Check that the linker actually ran again @@ -1184,7 +1187,7 @@ public void ILLink_keeps_symbols_by_default(string targetFramework) .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1217,7 +1220,7 @@ public void ILLink_removes_symbols_when_debugger_support_is_disabled(string targ .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:DebuggerSupport=false").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:DebuggerSupport=false").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1245,7 +1248,7 @@ public void ILLink_accepts_option_to_remove_symbols(string targetFramework) .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimmerRemoveSymbols=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimmerRemoveSymbols=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1273,7 +1276,7 @@ public void ILLink_symbols_option_can_override_defaults_from_debugger_support(st .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:DebuggerSupport=false", "/p:TrimmerRemoveSymbols=false").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1305,7 +1308,7 @@ public void ILLink_can_treat_warnings_as_errors(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:WarningsAsErrors=IL2075") .Should().Fail() .And.HaveStdOutContaining("error IL2075") @@ -1324,7 +1327,7 @@ public void ILLink_can_treat_warnings_not_as_errors(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:TreatWarningsAsErrors=true", "/p:EnableTrimAnalyzer=false") .Should().Fail() .And.HaveStdOutContaining("warning IL2026") @@ -1348,7 +1351,7 @@ public void ILLink_can_ignore_warnings(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:NoWarn=IL2075", "/p:WarnAsError=IL2075") .Should().Pass() .And.NotHaveStdOutContaining("warning IL2075") @@ -1367,7 +1370,7 @@ public void ILLink_respects_analysis_level(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:AnalysisLevel=0.0") .Should().Pass().And.NotHaveStdOutMatching(@"warning IL\d\d\d\d"); } @@ -1383,7 +1386,7 @@ public void ILLink_respects_warning_level_independently(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", // This tests the linker only. The analyzer doesn't respect ILLinkWarningLevel. "/p:EnableTrimAnalyzer=false", "/p:ILLinkWarningLevel=0") @@ -1402,7 +1405,7 @@ public void ILLink_can_treat_warnings_as_errors_independently(string targetFrame var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:TreatWarningsAsErrors=true", "/p:ILLinkTreatWarningsAsErrors=false", "/p:EnableTrimAnalyzer=false") .Should().Pass() .And.HaveStdOutContaining("warning IL2026") @@ -1443,7 +1446,7 @@ public void ILLink_displays_informational_warning_up_to_net5_by_default(string t var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass().And.HaveStdOutContainingIgnoreCase("https://aka.ms/dotnet-illink"); } @@ -1460,7 +1463,7 @@ public void ILLink_displays_informational_warning_when_trim_analysis_warnings_ar var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SuppressTrimAnalysisWarnings=true") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SuppressTrimAnalysisWarnings=true") .Should().Pass().And.HaveStdOutContainingIgnoreCase("https://aka.ms/dotnet-illink") .And.HaveStdOutContainingIgnoreCase("This process might take a while"); } @@ -1478,7 +1481,7 @@ public void ILLink_dont_display_informational_warning_by_default_on_net6plus(str var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass().And.NotHaveStdErrContaining("https://aka.ms/dotnet-illink") .And.HaveStdOutContainingIgnoreCase("This process might take a while"); } @@ -1496,10 +1499,10 @@ public void ILLink_dont_display_time_awareness_message_on_incremental_build(stri var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass().And.HaveStdOutContainingIgnoreCase("This process might take a while"); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") .Should().Pass().And.NotHaveStdErrContaining("This process might take a while"); } @@ -2085,7 +2088,8 @@ public static void FeatureImplementation() private void CheckILLinkVersion(TestAsset testAsset, string targetFramework) { - var getKnownPacks = new GetValuesCommand(testAsset, "KnownILLinkPack", GetValuesCommand.ValueType.Item, targetFramework) { + var getKnownPacks = new GetValuesCommand(testAsset, "KnownILLinkPack", GetValuesCommand.ValueType.Item, targetFramework) + { MetadataNames = new List { "TargetFramework", "ILLinkPackVersion" } }; getKnownPacks.Execute().Should().Pass(); diff --git a/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs b/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs index b1216aee1719..0034c1bdee6f 100644 --- a/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs @@ -30,6 +30,7 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Trimmed_Apps(string targe var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName); testProject.AdditionalProperties["PublishTrimmed"] = "true"; testProject.AdditionalProperties["RuntimeIdentifier"] = rid; + testProject.AdditionalProperties["SelfContained"] = "true"; testProject.PropertiesToRecord.Add("TrimMode"); var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: projectName + targetFramework); diff --git a/src/Tests/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolSelfContainedProject.cs b/src/Tests/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolSelfContainedProject.cs index 0a2dd5ebcc7d..0c6006a3f69d 100644 --- a/src/Tests/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolSelfContainedProject.cs +++ b/src/Tests/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolSelfContainedProject.cs @@ -31,7 +31,7 @@ public void It_should_fail_with_error_message() var packCommand = new PackCommand(Log, helloWorldAsset.TestRoot); - CommandResult result = packCommand.Execute(); + CommandResult result = packCommand.Execute("--property:SelfContained=true"); result.ExitCode.Should().NotBe(0); result.StdOut.Should().Contain(Strings.PackAsToolCannotSupportSelfContained); } @@ -44,7 +44,7 @@ public void It_should_not_fail_on_build() var packCommand = new BuildCommand(helloWorldAsset); - CommandResult result = packCommand.Execute(); + CommandResult result = packCommand.Execute("--property:SelfContained=true"); result.ExitCode.Should().Be(0); } From 298649f8547c1e26e86512fa27ac50b95a52b42c Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 23 Jan 2023 13:30:06 -0800 Subject: [PATCH 05/60] Update global property flow test to not expect rid to infer sc --- .../GlobalPropertyFlowTests.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index 86de89a9c09a..22ca333f1475 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -84,9 +84,7 @@ public void TestGlobalPropertyFlowToLibrary(bool passSelfContained, bool passRun { var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; - - ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false); } @@ -101,10 +99,8 @@ public void TestGlobalPropertyFlowToExe(bool passSelfContained, bool passRuntime var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; - - ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); } @@ -137,11 +133,9 @@ public void TestGlobalPropertyFlowToExeWithSelfContainedFalse(bool passSelfConta var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; - - ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); // SelfContained will only flow to referenced project if it's explicitly passed in this case - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); } } From 08ae557a98bda3d4adaac541534c6fad89850974 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 23 Jan 2023 16:54:35 -0800 Subject: [PATCH 06/60] Update blazor wasm tests to add SC with the new RID change Make blazor tests not give SC if already defined. Fix additional tests expecting old RID -> SC behavior Blazor WASM Update test assets Blazor WASM Tests Updated to add SelfContained when a RuntimeIdentifier is specified to keep old behavior after .NET 8 breaking change. GlobalPropertyFlowTests now expect RID to not Infer SC * Note that the failure was moved from 1 function to another ... technically the old test failed because it was relying on RID setting SC which would cause a failure as one EXE was SC but the other wasn't. With the new change, that no longer occured Meanwhile, the other test relied on the properties flowing the RID. When the RID flowed, SC would be inferred, so the referenced project would be an EXE. But now it's not inferred, so this test should instead fail. --- .../blazorhosted/blazorhosted.csproj | 5 ++ .../BlazorHosted/blazorwasm/blazorwasm.csproj | 5 ++ .../blazorhosted/blazorhosted-rid.csproj | 5 ++ .../blazorwasm/blazorwasm.csproj | 6 ++ .../ValidateExecutableReferences.cs | 8 --- .../DepsFileSkipTests.cs | 2 + .../GlobalPropertyFlowTests.cs | 58 +++++++++---------- ...NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj | 5 ++ 8 files changed, 56 insertions(+), 38 deletions(-) diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index 5099648fae48..e51ae38e412d 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,6 +8,11 @@ + + + true + + diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index 4f8114d59e1f..bf746567f89d 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -37,4 +37,9 @@ <_BlazorBrotliCompressionLevel>NoCompression + + + true + + diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index ec4b53947305..54b7fc3fec04 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -14,6 +14,11 @@ + + + true + + diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 49b8c0e4c310..2b1606ed9bcd 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -36,4 +36,10 @@ <_BlazorBrotliCompressionLevel>NoCompression + + + true + + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs index 9e0b461f27c3..45d791aea309 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs @@ -75,14 +75,6 @@ protected override void ExecuteCore() { referencedProjectIsSelfContained = true; } - - // If the project is NOT RID agnostic, then a global RuntimeIdentifier will flow to it. - // If the project didn't explicitly specify a value for SelfContained, then this will - // set SelfContained to true - if (runtimeIdentifierIsGlobalProperty && !referencedProjectHadSelfContainedSpecified) - { - referencedProjectIsSelfContained = true; - } } if (referencedProjectIsExecutable && shouldBeValidatedAsExecutableReference) diff --git a/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs b/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs index 8795de444adf..c0c8c124ee9c 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs @@ -52,6 +52,7 @@ public void RuntimeAssemblyFromRuntimePackCanBeSkipped() IsExe = true }; + testProject.AdditionalProperties["SelfContained"] = "true"; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); string filenameToSkip = "Microsoft.CSharp.dll"; @@ -105,6 +106,7 @@ public void NativeAssetFromRuntimePackCanBeSkipped() IsExe = true }; + testProject.AdditionalProperties["SelfContained"] = "true"; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); string filenameToSkip = FileConstants.DynamicLibPrefix + "coreclr" + FileConstants.DynamicLibSuffix; diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index 22ca333f1475..5c8556395c4c 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -116,29 +116,13 @@ public void TestGlobalPropertyFlowToExeWithSelfContainedFalse(bool passSelfConta string identifier = passSelfContained.ToString() + "_" + passRuntimeIdentifier; - if (!passSelfContained && passRuntimeIdentifier) - { - // This combination results in a build error because it ends up being a self-contained Exe referencing a framework dependent one - var testAsset = _testAssetsManager.CreateTestProject(_testProject, identifier: identifier); + var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - new DotnetBuildCommand(testAsset, "-r", EnvironmentInfo.GetCompatibleRid()) - .Execute() - .Should() - .Fail() - .And - .HaveStdOutContaining("NETSDK1150"); - } - else - { - - var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); - // SelfContained will only flow to referenced project if it's explicitly passed in this case - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); - } + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); } + [RequiresMSBuildVersionTheory("17.4.0.41702")] [InlineData(true, true)] [InlineData(true, false)] @@ -176,18 +160,32 @@ public void TestGlobalPropertyFlowToMultitargetedProject(bool passSelfContained, project.Root.Element("PropertyGroup").Add(XElement.Parse(@"Library")); }); - var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); + string identifier = passSelfContained.ToString() + "_" + passRuntimeIdentifier; - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + if (!passSelfContained && passRuntimeIdentifier) + { + var testAsset = _testAssetsManager.CreateTestProject(_testProject, identifier: identifier); + + new DotnetBuildCommand(testAsset, "-r", EnvironmentInfo.GetCompatibleRid()) + .Execute() + .Should() + .Fail() + .And + .HaveStdOutContaining("NETSDK1150"); + } + else + { + var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained, - targetFramework: "net6.0"); - ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained, - targetFramework: "net7.0"); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false, - targetFramework: "net6.0"); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained, - targetFramework: "net7.0"); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + targetFramework: "net6.0"); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + targetFramework: "net7.0"); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + targetFramework: "net6.0"); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + targetFramework: "net7.0"); + } } [RequiresMSBuildVersionTheory("17.4.0.41702", Skip = "https://github.com/dotnet/msbuild/issues/8154")] diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj index a8b9bf362a2f..261ff0b4f046 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj @@ -14,6 +14,11 @@ false + + + true + + From 3fd0e6d56410ee73ba0bce131725d4d0fc42b973 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 24 Jan 2023 16:03:54 -0800 Subject: [PATCH 07/60] Fix test with missing framework for RID breaking change --- .../GivenThatWeWantToBuildASelfContainedApp.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 3799d4ae3ca0..07e190d10313 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -424,6 +424,7 @@ public void It_does_or_doesnt_warn_based_on_SelfContained_and_TargetFramework_br var testAsset = _testAssetsManager .CopyTestAsset("HelloWorld", identifier: targetFramework + defineSelfContained.ToString()) .WithSource() + .WithTargetFramework(targetFramework) .WithProjectChanges(project => { var ns = project.Root.Name.Namespace; @@ -432,8 +433,10 @@ public void It_does_or_doesnt_warn_based_on_SelfContained_and_TargetFramework_br propertyGroup.Add(new XElement(ns + "SelfContained", defineSelfContained ? "true" : "")); }); - var buildCommand = new BuildCommand(testAsset); - var commandResult = buildCommand.Execute(); + var buildCommand = new DotnetBuildCommand(Log); + var commandResult = buildCommand + .WithWorkingDirectory(testAsset.Path) + .Execute("/bl"); if (targetFramework == "net7.0" && !defineSelfContained) { From 22283618762fee99f8003462cabd21cda76b30f8 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 24 Jan 2023 16:18:36 -0800 Subject: [PATCH 08/60] Update Framework References tests to add SelfContained per breaking change in .net 8 --- .../Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs index 3ce1ce8c5403..280b34bb6ac6 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs @@ -534,6 +534,7 @@ public void RuntimeFrameworkVersionCanBeSpecifiedOnFrameworkReference() string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["RuntimeFrameworkVersion"] = "3.0.0-runtimeframeworkversion-property"; + testProject.AdditionalProperties["SelfContained"] = "true"; var resolvedVersions = GetResolvedVersions(testProject, project => @@ -566,6 +567,7 @@ public void RuntimeFrameworkVersionCanBeSpecifiedViaProperty() string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["RuntimeFrameworkVersion"] = runtimeFrameworkVersion; + testProject.AdditionalProperties["SelfContained"] = "true"; var resolvedVersions = GetResolvedVersions(testProject); @@ -590,6 +592,7 @@ public void TargetLatestPatchCanBeSpecifiedOnFrameworkReference(bool attributeVa string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["TargetLatestRuntimePatch"] = (!attributeValue).ToString(); + testProject.AdditionalProperties["SelfContained"] = "true"; var resolvedVersions = GetResolvedVersions(testProject, project => @@ -626,6 +629,7 @@ public void TargetLatestPatchCanBeSpecifiedViaProperty(bool propertyValue) string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["TargetLatestRuntimePatch"] = propertyValue.ToString(); + testProject.AdditionalProperties["SelfContained"] = "true"; var resolvedVersions = GetResolvedVersions(testProject, identifier: propertyValue.ToString()); @@ -648,6 +652,7 @@ public void TargetingPackVersionCanBeSpecifiedOnFrameworkReference() var testProject = new TestProject(); string targetingPackVersion = "3.0.0-tpversionfromframeworkreference"; + testProject.AdditionalProperties["SelfContained"] = "true"; var resolvedVersions = GetResolvedVersions(testProject, project => From 2202db1c972e3072a308fc8ec2ffc9a1a8889052 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 24 Jan 2023 16:25:05 -0800 Subject: [PATCH 09/60] Update WPF tests that expected RID to give SC --- src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs index 280b34bb6ac6..aaa63f2bce2f 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs @@ -979,6 +979,7 @@ private void TestFrameworkReferenceProfiles( if (selfContained) { testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); + testProject.AdditionalProperties["SelfContained"] = "true"; } string identifier = selfContained ? "_selfcontained" : string.Empty; From 2eb3e948a5b38324a233bab19d3e8be988964e21 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 24 Jan 2023 16:27:37 -0800 Subject: [PATCH 10/60] Update framework reference invalid rid and trimmable tests to no longer expect SC to give a RID. --- .../Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs index aaa63f2bce2f..2a4c36014298 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs @@ -87,8 +87,8 @@ public void Multiple_frameworks_are_written_to_runtimeconfig_for_self_contained_ IsExe = true }; - // Specifying RID makes the produced app self-contained. testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); + testProject.AdditionalProperties["SelfContained"] = "true"; if (tfm == ToolsetInfo.CurrentTargetFramework) { @@ -433,6 +433,8 @@ public void BuildFailsIfRuntimePackIsNotAvailableForRuntimeIdentifier() RuntimeIdentifier = "linux-x64" }; + testProject.AdditionalProperties["SelfContained"] = "true"; + var testAsset = _testAssetsManager.CreateTestProject(testProject) .WithProjectChanges(project => { @@ -470,6 +472,8 @@ public void BuildFailsIfInvalidRuntimeIdentifierIsSpecified() RuntimeIdentifier = "invalid-rid" }; + testProject.AdditionalProperties["SelfContained"] = "true"; + var testAsset = _testAssetsManager.CreateTestProject(testProject); var restoreCommand = new RestoreCommand(testAsset); @@ -1139,6 +1143,7 @@ private ResolvedVersionInfo GetResolvedVersions(TestProject testProject, testProject.TargetFrameworks = targetFramework;; testProject.IsExe = true; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); + testProject.AdditionalProperties["SelfContained"] = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject, callingMethod, identifier); if (projectChanges != null) From 3e4f40de69e3fd8ff406ed4102544497def05834 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 25 Jan 2023 09:38:44 -0800 Subject: [PATCH 11/60] Repair some publish profile tests to add SelfContained and update another blazor test asset to add SC --- .../BlazorWasmMinimal/blazorwasm-minimal.csproj | 5 +++++ .../GlobalPropertyFlowTests.cs | 2 +- .../GivenThatWeWantToPublishAHelloWorldProject.cs | 4 ++-- .../GivenThatWeWantToPublishAWebApp.cs | 4 ++-- .../GivenThatWeWantToPublishReadyToRun.cs | 13 ++++++++----- .../GivenThatWeWantToPublishWithoutConflicts.cs | 6 ++++-- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj b/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj index 4cbb5bd7234f..f695203de178 100644 --- a/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj +++ b/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj @@ -10,6 +10,11 @@ + + + true + + diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index 5c8556395c4c..cc2678275dfa 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -181,7 +181,7 @@ public void TestGlobalPropertyFlowToMultitargetedProject(bool passSelfContained, targetFramework: "net6.0"); ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, targetFramework: "net7.0"); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false, targetFramework: "net6.0"); ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, targetFramework: "net7.0"); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs index e2a81de3497f..d57df5a6ee2e 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs @@ -1000,7 +1000,7 @@ public void It_publishes_with_a_publish_profile(bool? selfContained, bool? useAp $"{testProject.Name}.runtimeconfig.json", }); - if (selfContained ?? true) + if (selfContained ?? false) { output.Should().HaveFiles(new[] { $"{FileConstants.DynamicLibPrefix}hostfxr{FileConstants.DynamicLibSuffix}", @@ -1015,7 +1015,7 @@ public void It_publishes_with_a_publish_profile(bool? selfContained, bool? useAp }); } - if ((selfContained ?? true) || (useAppHost ?? true)) + if ((selfContained ?? false) || (useAppHost ?? true)) { output.Should().HaveFile($"{testProject.Name}{Constants.ExeSuffix}"); } diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs index ed7f4e373072..e22235145b06 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs @@ -214,7 +214,7 @@ public void PublishWebAppWithPublishProfile(bool? selfContained, bool? useAppHos $"{testProject.Name}.runtimeconfig.json" }); - if (selfContained ?? true) + if (selfContained ?? false) { output.Should().HaveFiles(new[] { $"{FileConstants.DynamicLibPrefix}hostfxr{FileConstants.DynamicLibSuffix}", @@ -229,7 +229,7 @@ public void PublishWebAppWithPublishProfile(bool? selfContained, bool? useAppHos }); } - if ((selfContained ?? true) || (useAppHost ?? true)) + if ((selfContained ?? false) || (useAppHost ?? true)) { output.Should().HaveFile($"{testProject.Name}{Constants.ExeSuffix}"); } diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs index 8533180a8737..195502fab2b0 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs @@ -114,7 +114,7 @@ public void It_creates_readytorun_symbols_when_switch_is_used(string targetFrame [InlineData(ToolsetInfo.CurrentTargetFramework)] public void It_supports_framework_dependent_publishing(string targetFramework) { - TestProjectPublishing_Internal("FrameworkDependent", targetFramework, isSelfContained: false, composite: false, emitNativeSymbols:true, identifier: targetFramework); + TestProjectPublishing_Internal("FrameworkDependent", targetFramework, isSelfContained: false, composite: false, emitNativeSymbols: true, identifier: targetFramework); } [Theory] @@ -210,7 +210,7 @@ public void It_can_publish_readytorun_for_library_projects(string targetFramewor [InlineData(ToolsetInfo.CurrentTargetFramework)] public void It_can_publish_readytorun_for_selfcontained_library_projects(string targetFramework) { - TestProjectPublishing_Internal("LibraryProject2", targetFramework, isSelfContained:true, composite: true, makeExeProject: false, identifier: targetFramework); + TestProjectPublishing_Internal("LibraryProject2", targetFramework, isSelfContained: true, composite: true, makeExeProject: false, identifier: targetFramework); } [RequiresMSBuildVersionTheory("17.0.0.32901")] @@ -276,7 +276,7 @@ public void It_supports_libraries_when_using_crossgen2(string targetFramework) [InlineData(ToolsetInfo.CurrentTargetFramework, "win-x86", "windows", "X86,X64,Arm64,Arm", "_", "_")] public void It_supports_crossos_arch_compilation(string targetFramework, string runtimeIdentifier, string sdkSupportedOs, string sdkSupportedArch, string composite, string selfcontained) { - var projectName = $"CrossArchOs{targetFramework}{runtimeIdentifier.Replace("-",".")}{composite}{selfcontained}"; + var projectName = $"CrossArchOs{targetFramework}{runtimeIdentifier.Replace("-", ".")}{composite}{selfcontained}"; string sdkOs = "NOTHING"; if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { @@ -301,7 +301,7 @@ public void It_supports_crossos_arch_compilation(string targetFramework, string string sdkArch = RuntimeInformation.ProcessArchitecture.ToString(); Log.WriteLine($"sdkArch = {sdkArch}"); - Assert.Contains(sdkArch, new string[]{"Arm", "Arm64", "X64", "X86"}); // Assert that the Architecture in use is a known architecture + Assert.Contains(sdkArch, new string[] { "Arm", "Arm64", "X64", "X86" }); // Assert that the Architecture in use is a known architecture if (!sdkSupportedArch.Split(',').Contains(sdkArch)) { Log.WriteLine("Running test on processor architecture that doesn't support this cross platform build"); @@ -341,7 +341,7 @@ private static TargetOSEnum GetTargetOS(string runtimeIdentifier) runtimeIdentifier.Contains("sles") || runtimeIdentifier.Contains("tizen")) { - return TargetOSEnum.Linux; + return TargetOSEnum.Linux; } Assert.True(false, $"{runtimeIdentifier} could not be converted into a known OS type. Adjust the if statement above until this does not happen"); @@ -460,6 +460,9 @@ public string Func() RuntimeIdentifier = runtimeIdentifier ?? EnvironmentInfo.GetCompatibleRid(targetFramework), ReferencedProjects = { referenceProject }, }; + + testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SourceFiles[$"{mainProjectName}.cs"] = @" using System; public class Program diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs index 11c6f4d6049f..7bb84884ad5f 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs @@ -38,7 +38,7 @@ public void It_solves_conflicts_between_package_and_implicit_references() var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); var getValuesCommand = new GetValuesCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name), targetFramework, "ResolvedFileToPublish", GetValuesCommand.ValueType.Item) - { + { DependsOnTargets = "Publish" }; @@ -69,6 +69,7 @@ public void It_has_consistent_behavior_when_publishing_single_file(bool shouldPu IsExe = true, RuntimeIdentifier = "win-x64" }; + testProject.AdditionalProperties["SelfContained"] = "true"; // The Microsoft.TestPlatform.CLI package contains System.Runtime.CompilerServices.Unsafe.dll as content, which could cause a double write with the same dll originating from the // runtime package. Without _HandleFileConflictsForPublish this would be caught when by the bundler when publishing single file, but a normal publish would succeed with double writes. testProject.PackageReferences.Add(new TestPackageReference("Microsoft.TestPlatform.CLI", "16.5.0")); @@ -79,7 +80,8 @@ public void It_has_consistent_behavior_when_publishing_single_file(bool shouldPu DependsOnTargets = "Publish" }; - if (shouldPublishSingleFile) { + if (shouldPublishSingleFile) + { getValuesCommand.Execute("/p:PublishSingleFile=true") .Should() .Pass(); From a8ef8c3ae9c85734bea361d350219263a68d5a1b Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 25 Jan 2023 10:09:54 -0800 Subject: [PATCH 12/60] Update dotnet build tests to add SelfContained explicitly when needed for 8 breaking change --- ...GivenThatWeWantToBuildASelfContainedApp.cs | 2 + .../GivenThatWeWantToCopyLocalDependencies.cs | 39 ++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 07e190d10313..9a6c509e77c7 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -263,6 +263,8 @@ static int Last2DigitsTo0(int versionBuild) RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid() }; + testProject.AdditionalProperties["SelfContained"] = "true"; + // Set up test FrameworkReference that will use workload manifest to resolve versions testProject.ProjectChanges.Add(project => { diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs index 28498a7cfaee..5b025a9f3ac9 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs @@ -42,8 +42,8 @@ public void It_copies_local_package_dependencies_on_build() testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -53,7 +53,7 @@ public void It_copies_local_package_dependencies_on_build() var outputDirectory = buildCommand.GetOutputDirectory(testProject.TargetFrameworks); - var expectedFiles = new [] + var expectedFiles = new[] { $"{ProjectName}{Constants.ExeSuffix}", $"{ProjectName}.deps.json", @@ -86,8 +86,8 @@ public void It_does_not_copy_local_package_dependencies_when_requested_not_to() testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -122,8 +122,8 @@ public void It_copies_local_specific_runtime_package_dependencies_on_build() testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -160,8 +160,8 @@ public void It_does_not_copy_local_package_dependencies_for_lib_projects() testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -193,8 +193,8 @@ public void It_copies_local_package_dependencies_for_lib_projects_when_requested testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -229,8 +229,8 @@ public void It_does_not_copy_local_package_dependencies_for_netstandard_projects testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -262,8 +262,8 @@ public void It_copies_local_package_dependencies_for_netstandard_projects_when_r testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -298,8 +298,8 @@ public void It_does_not_copy_local_runtime_dependencies_for_netframework_project testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); @@ -330,11 +330,12 @@ public void It_copies_local_all_assets_on_self_contained_build() }; testProject.AdditionalProperties.Add("RuntimeIdentifier", rid); + testProject.AdditionalProperties["SelfContained"] = "true"; testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); - var testProjectInstance = _testAssetsManager - .CreateTestProject(testProject); + var testProjectInstance = _testAssetsManager + .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); From 0042e6e3ff3d0a5c1c1b4667565d3d6fd667e076 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 25 Jan 2023 10:11:37 -0800 Subject: [PATCH 13/60] Update publish profile tests to add SC explicitly per .net 8 breaking change --- .../GivenThatWeWantToPublishAHelloWorldProject.cs | 2 +- .../GivenThatWeWantToPublishAWebApp.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs index d57df5a6ee2e..12adabbef56e 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs @@ -980,7 +980,7 @@ public void It_publishes_with_a_publish_profile(bool? selfContained, bool? useAp {rid} {(selfContained.HasValue ? $"{selfContained}" : "")} - {((!(selfContained ?? true) && useAppHost.HasValue) ? $"{useAppHost}" : "")} + {((!(selfContained ?? false) && useAppHost.HasValue) ? $"{useAppHost}" : "")} "); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs index e22235145b06..6c117045fb83 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs @@ -194,7 +194,7 @@ public void PublishWebAppWithPublishProfile(bool? selfContained, bool? useAppHos {rid} {(selfContained.HasValue ? $"{selfContained}" : "")} - {((!(selfContained ?? true) && useAppHost.HasValue) ? $"{useAppHost}" : "")} + {((!(selfContained ?? false) && useAppHost.HasValue) ? $"{useAppHost}" : "")} "); From 07848f62aa237ef1db096bccbc4977a7e3110be1 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 25 Jan 2023 15:28:54 -0800 Subject: [PATCH 14/60] Fix EXE global property flow tests to add SelfContained now when a RID is given. --- .../GlobalPropertyFlowTests.cs | 10 +++------- .../Microsoft.NET.Build.Tests/ReferenceExeTests.cs | 4 ++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index cc2678275dfa..c00a726690ef 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -135,13 +135,9 @@ public void TestGlobalPropertyFlowToLibraryWithRuntimeIdentifier(bool passSelfCo var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; - - ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, - // Right now passing "--self-contained" also causes the RuntimeIdentifier to be passed as a global property. - // That should change with https://github.com/dotnet/sdk/pull/26143, which will likely require updating this and other tests in this class - expectedRuntimeIdentifier: buildingSelfContained ? "" : _referencedProject.RuntimeIdentifier); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + expectedRuntimeIdentifier: passRuntimeIdentifier ? "" : _referencedProject.RuntimeIdentifier); } [RequiresMSBuildVersionTheory("17.4.0.41702")] diff --git a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs index 54d80ac90fd6..2c49a7e38105 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs @@ -242,8 +242,12 @@ public void ReferencedExeCanRunWhenReferencesExeWithSelfContainedMismatchForDiff project.Root.Element(ns + "PropertyGroup") .Add(XElement.Parse($@"" + EnvironmentInfo.GetCompatibleRid() + "")); + + project.Root.Element(ns + "PropertyGroup") + .Add(new XElement(ns + "SelfContained", "true")); }); + RunTest(); } From 552b1b35411ae921c5403a4b5602ede8d7fbd657 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 25 Jan 2023 15:38:29 -0800 Subject: [PATCH 15/60] Blazor: Add SelfContained in SDK tasks project instead of the test projects --- .../BlazorHosted/blazorhosted/blazorhosted.csproj | 5 ----- .../TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj | 5 ----- .../BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj | 5 ----- .../BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj | 6 ------ .../Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj | 7 ++++++- 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index e51ae38e412d..5099648fae48 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,11 +8,6 @@ - - - true - - diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index bf746567f89d..7d954871cacf 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -36,10 +36,5 @@ <_BlazorBrotliCompressionLevel>NoCompression - - - - true - diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index 54b7fc3fec04..5fb537b62fe6 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -13,11 +13,6 @@ - - - - true - diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 2b1606ed9bcd..0079500b0cc5 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -35,11 +35,5 @@ <_BlazorBrotliCompressionLevel>NoCompression - - - - true - - diff --git a/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj b/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj index 960152d37196..8d7fabfdc4a1 100644 --- a/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj +++ b/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj @@ -1,4 +1,4 @@ - + $(RepoRoot)\src\BlazorWasmSdk\ @@ -28,6 +28,11 @@ true + + + true + + SDK for building and publishing Blazor WebAssembly applications. Library From 836ca0d95ba7df67073bb391475ad4564437f646 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 25 Jan 2023 15:43:01 -0800 Subject: [PATCH 16/60] Revert "Blazor: Add SelfContained in SDK tasks project instead of the test projects" This reverts commit 552b1b35411ae921c5403a4b5602ede8d7fbd657. --- .../BlazorHosted/blazorhosted/blazorhosted.csproj | 5 +++++ .../TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj | 5 +++++ .../BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj | 5 +++++ .../BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj | 6 ++++++ .../Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj | 7 +------ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index 5099648fae48..e51ae38e412d 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,6 +8,11 @@ + + + true + + diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index 7d954871cacf..bf746567f89d 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -36,5 +36,10 @@ <_BlazorBrotliCompressionLevel>NoCompression + + + + true + diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index 5fb537b62fe6..54b7fc3fec04 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -13,6 +13,11 @@ + + + + true + diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 0079500b0cc5..2b1606ed9bcd 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -35,5 +35,11 @@ <_BlazorBrotliCompressionLevel>NoCompression + + + + true + + diff --git a/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj b/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj index 8d7fabfdc4a1..960152d37196 100644 --- a/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj +++ b/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj @@ -1,4 +1,4 @@ - + $(RepoRoot)\src\BlazorWasmSdk\ @@ -28,11 +28,6 @@ true - - - true - - SDK for building and publishing Blazor WebAssembly applications. Library From c0ce586e224bdcb7c36bf41a34d21e4e188f27a8 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 26 Jan 2023 09:17:06 -0800 Subject: [PATCH 17/60] Update warning and remove old warning Remove the old self-contained warning as it would be redundant with the breaking change warning and only occurred with -r. Co-authored-by: richlander --- src/Tasks/Common/Resources/Strings.resx | 2 +- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf | 4 ++-- src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf | 4 ++-- src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 1a3e0a84f393..b18ecfb10b8c 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -892,7 +892,7 @@ You may need to build the project on another operating system or architecture, o {StrBegin="NETSDK1196: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 0f49153ed726..2d79b46287d4 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 2712ea3b6bdb..63cb1d709689 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 369b6e22ffdc..0277aa608970 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 9638c576a7da..5cec1533129e 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 13dae7bf6122..16c2e7da52de 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index da3331d87d07..52a5264bd044 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 8ab084482ffc..fc5fad2976ff 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 951de8385424..ed16b4be8974 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index c9ee10b9a33f..638876024e7a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 15ce16bd76c4..e8b1b5eeda59 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index feba8bde85b2..7267415b72bb 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 2b9330fefae1..1039e6659d8c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index f125ce724fd6..e3b771587718 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -791,8 +791,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. - NETSDK1198: For projects with TargetFrameworks >= 8.0, RuntimeIdentifier no longer automatically gives a SelfContained app. To continue creating a .NET framework independent app after upgrading to 8.0, consider setting SelfContained explicitly. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. {StrBegin="NETSDK1198: "} diff --git a/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs b/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs index 4595ae11ffb7..d1e0cee5d05d 100644 --- a/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs +++ b/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs @@ -179,7 +179,7 @@ public void DotnetBuildDoesNotPrintCopyrightInfo() } [Fact] - public void It_warns_on_rid_without_self_contained_options() + public void It_no_longer_warns_on_rid_without_self_contained_options() { var testInstance = _testAssetsManager.CopyTestAsset("HelloWorld") .WithSource() @@ -192,7 +192,7 @@ public void It_warns_on_rid_without_self_contained_options() .Should() .Pass() .And - .HaveStdOutContaining("NETSDK1179"); + .NotHaveStdOutContaining("NETSDK1179"); } [Fact] From 0e27149b6a82ff53789bd3d023ea2fe56c95da02 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 26 Jan 2023 09:27:08 -0800 Subject: [PATCH 18/60] Update newly added breaking change test to also assert SelfContained is correct regardless of the value --- .../GivenThatWeWantToBuildASelfContainedApp.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 9a6c509e77c7..9d12ef8752b2 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -409,11 +409,7 @@ public void It_does_or_doesnt_imply_SelfContained_based_on_RuntimeIdentifier_and .Pass(); var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: targetFramework); - if (resultShouldBeSelfContained) - { - Assert.True(bool.Parse(properties["SelfContained"]) == resultShouldBeSelfContained); - } - + Assert.True(bool.Parse(properties["SelfContained"]) == resultShouldBeSelfContained); } [Theory] From d4ed80cab52aa367f22baf2b751d58ec8befdc09 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 26 Jan 2023 09:29:56 -0800 Subject: [PATCH 19/60] Don't add `SelfContained` twice in the IL Link test, as this was a mistake Co-authored-by: Sven Boemer --- .../Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index e984f230652a..5666d7772898 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -230,7 +230,7 @@ public void ILLink_respects_global_TrimMode(string targetFramework, string trimM .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; From 3026631542d23d9edf80cd622f39d21dbe999b83 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 26 Jan 2023 09:30:08 -0800 Subject: [PATCH 20/60] Don't add `SelfContained` twice in the test, as this was a mistake Co-authored-by: Sven Boemer --- .../Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 5666d7772898..8aaf3d89c5a9 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -265,7 +265,7 @@ public void ILLink_roots_IntermediateAssembly(string targetFramework) .WithProjectChanges(project => SetMetadata(project, projectName, "IsTrimmable", "True")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; From fb31004850ded414c0997b3864a62367701bb75e Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 26 Jan 2023 09:30:19 -0800 Subject: [PATCH 21/60] Don't add `SelfContained` twice in the test, as this was a mistake Co-authored-by: Sven Boemer --- .../Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 8aaf3d89c5a9..2229592a0a9a 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -289,7 +289,7 @@ public void ILLink_respects_TrimmableAssembly(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; From ada4f72f878ab2a4d9f475e6cc732b3e09e460a2 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 27 Jan 2023 11:36:55 -0800 Subject: [PATCH 22/60] Improve test code quality by adding SelfContained in less places where possible (IL Link) and other minor code style improvements from other PR feedback --- .../blazorhosted/blazorhosted.csproj | 2 +- .../BlazorHosted/blazorwasm/blazorwasm.csproj | 2 +- .../blazorhosted/blazorhosted-rid.csproj | 2 +- .../blazorwasm-minimal.csproj | 2 +- .../blazorwasm/blazorwasm.csproj | 2 +- ...GivenThatWeWantToBuildASelfContainedApp.cs | 2 +- .../GivenThatWeWantToRunILLink.cs | 110 +++++++++--------- ...NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj | 2 +- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index e51ae38e412d..c3bc93432540 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,7 +8,7 @@ - + true diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index bf746567f89d..35b69bb52bf7 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -37,7 +37,7 @@ <_BlazorBrotliCompressionLevel>NoCompression - + true diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index 54b7fc3fec04..18a9759d9117 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -14,7 +14,7 @@ - + true diff --git a/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj b/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj index f695203de178..a3d5164664ef 100644 --- a/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj +++ b/src/Assets/TestProjects/BlazorWasmMinimal/blazorwasm-minimal.csproj @@ -10,7 +10,7 @@ - + true diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 2b1606ed9bcd..9efdbc1a2091 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -36,7 +36,7 @@ <_BlazorBrotliCompressionLevel>NoCompression - + true diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 9d12ef8752b2..4f4c2014493e 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -409,7 +409,7 @@ public void It_does_or_doesnt_imply_SelfContained_based_on_RuntimeIdentifier_and .Pass(); var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: targetFramework); - Assert.True(bool.Parse(properties["SelfContained"]) == resultShouldBeSelfContained); + Assert.Equal(bool.Parse(properties["SelfContained"]), resultShouldBeSelfContained); } [Theory] diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 2229592a0a9a..9884e8ea45b9 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -45,7 +45,7 @@ public void ILLink_only_runs_when_switch_is_enabled(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -83,7 +83,7 @@ public void ILLink_runs_and_creates_linked_app(string targetFramework, bool refe .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -121,7 +121,7 @@ public void ILLink_links_simple_app_without_analysis_warnings_and_it_runs(string var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework + trimMode); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:TrimMode={trimMode}", "/p:SuppressTrimAnalysisWarnings=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", $"/p:TrimMode={trimMode}", "/p:SuppressTrimAnalysisWarnings=true") .Should().Pass() .And.NotHaveStdOutContaining("warning IL2075") .And.NotHaveStdOutContaining("warning IL2026"); @@ -155,7 +155,7 @@ public void ILLink_fails_when_no_matching_pack_is_found(string targetFramework) }); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true") .Should().Fail() .And.HaveStdOutContaining("error NETSDK1195"); } @@ -173,7 +173,7 @@ public void PrepareForILLink_can_set_IsTrimmable(string targetFramework) .WithProjectChanges(project => SetMetadata(project, referenceProjectName, "IsTrimmable", "True")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -198,7 +198,7 @@ public void PrepareForILLink_can_set_TrimMode(string targetFramework) .WithProjectChanges(project => SetMetadata(project, referenceProjectName, "TrimMode", "link")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -230,7 +230,7 @@ public void ILLink_respects_global_TrimMode(string targetFramework, string trimM .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -265,7 +265,7 @@ public void ILLink_roots_IntermediateAssembly(string targetFramework) .WithProjectChanges(project => SetMetadata(project, projectName, "IsTrimmable", "True")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -289,7 +289,7 @@ public void ILLink_respects_TrimmableAssembly(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -312,7 +312,7 @@ public void ILLink_respects_IsTrimmable_attribute(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -346,7 +346,7 @@ public void ILLink_IsTrimmable_metadata_can_override_attribute(string targetFram .WithProjectChanges(project => SetMetadata(project, "UnusedNonTrimmableAssembly", "IsTrimmable", "true")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/v:n").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/v:n").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -369,7 +369,7 @@ public void ILLink_TrimMode_applies_to_IsTrimmable_assemblies(string targetFrame var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -399,7 +399,7 @@ public void ILLink_TrimMode_new_options(string targetFramework, string trimMode) .WithProjectChanges(project => SetGlobalTrimMode(project, trimMode)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "-bl").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "-bl").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -439,7 +439,7 @@ public void ILLink_can_set_TrimmerDefaultAction(string targetFramework) .WithProjectChanges(project => SetTrimmerDefaultAction(project, "link")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -468,7 +468,7 @@ public void ILLink_analysis_warnings_are_disabled_by_default(string targetFramew var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}") .Should().Pass() // trim analysis warnings are disabled .And.NotHaveStdOutMatching(@"warning IL\d\d\d\d"); @@ -486,7 +486,7 @@ public void ILLink_analysis_warnings_are_enabled_by_default(string targetFramewo var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}") .Should().Pass() // trim analysis warnings are enabled .And.HaveStdOutMatching("warning IL2075.*Program.IL_2075") @@ -509,7 +509,7 @@ public void ILLink_accepts_option_to_enable_analysis_warnings(string targetFrame var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}") .Should().Pass() .And.HaveStdOutMatching("warning IL2075.*Program.IL_2075") .And.HaveStdOutMatching("warning IL2026.*Program.IL_2026.*Testing analysis warning IL2026") @@ -531,7 +531,7 @@ public void ILLink_accepts_option_to_disable_analysis_warnings(string targetFram var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}") .Should().Pass() .And.NotHaveStdOutContaining("warning IL2075") .And.NotHaveStdOutContaining("warning IL2026") @@ -553,7 +553,7 @@ public void ILLink_accepts_option_to_enable_analysis_warnings_without_PublishTri var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}") .Should().Pass() .And.HaveStdOutMatching("warning IL2026.*Program.IL_2026.*Testing analysis warning IL2026"); } @@ -569,7 +569,7 @@ public void ILLink_shows_single_warning_for_packagereferences_only(string target .WithSource(); var publishCommand = new PublishCommand(testAsset, "App"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}") .Should().Pass() .And.HaveStdOutMatching("IL2026: App.Program.Main.*Program.RUC") .And.HaveStdOutMatching("IL2026: ProjectReference.ProjectReferenceLib.Method.*ProjectReferenceLib.RUC") @@ -592,7 +592,7 @@ public void ILLink_accepts_option_to_show_all_warnings(string targetFramework) .WithSource(); var publishCommand = new PublishCommand(testAsset, "App"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:TrimmerSingleWarn=false") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:TrimmerSingleWarn=false") .Should().Pass() .And.HaveStdOutMatching("IL2026: App.Program.Main.*Program.RUC") .And.HaveStdOutMatching("IL2026: ProjectReference.ProjectReferenceLib.Method.*ProjectReferenceLib.RUC") @@ -618,7 +618,7 @@ public void ILLink_can_show_single_warning_per_assembly(string targetFramework) }); var publishCommand = new PublishCommand(testAsset, "App"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:TrimmerSingleWarn=false") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:TrimmerSingleWarn=false") .Should().Pass() .And.NotHaveStdOutMatching("IL2026: App.Program.Main.*Program.RUC") .And.NotHaveStdOutMatching("IL2026: ProjectReference.ProjectReferenceLib.Method.*ProjectReferenceLib.RUC") @@ -650,7 +650,7 @@ public void ILLink_errors_fail_the_build(string targetFramework) .WithProjectChanges(project => AddRootDescriptor(project, $"{projectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false") .Should().Fail() .And.HaveStdOutContaining("error IL1001") .And.HaveStdOutContaining(Strings.ILLinkFailed); @@ -705,7 +705,7 @@ public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_copyused(s var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimMode=copyused", "/p:TrimmerSingleWarn=false"); + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimMode=copyused", "/p:TrimmerSingleWarn=false"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, expectedOutput.ToArray(), targetFramework, rid); } @@ -764,7 +764,7 @@ public void ILLink_verify_analysis_warnings_framework_assemblies(string targetFr var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimMode=copy", "/p:_TrimmerDefaultAction=copy", "/p:TrimmerSingleWarn=false"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, expectedOutput.ToArray(), targetFramework, rid); @@ -781,7 +781,7 @@ public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_link(strin var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false"); + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, Array.Empty(), targetFramework, rid); } @@ -797,7 +797,7 @@ public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_link_5_0() var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false", + var result = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimmerSingleWarn=false", "/p:TrimMode=link"); result.Should().Pass(); ValidateWarningsOnHelloWorldApp(publishCommand, result, Array.Empty(), targetFramework, rid); @@ -847,7 +847,7 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: projectName + targetFramework); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true") .Should().Pass(); string outputDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -917,7 +917,7 @@ public void ILLink_accepts_root_descriptor(string targetFramework) // check whether the root descriptor actually roots only // the specified method. var extraArgs = $"--action link {referenceProjectName}"; - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", $"/p:_ExtraTrimmerArgs={extraArgs}", "/v:n").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -948,7 +948,7 @@ public void ILLink_error_on_nonboolean_optimization_flag(string property) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: property); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:{property}=NonBool") + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", $"/p:{property}=NonBool") .Should().Fail().And.HaveStdOutContaining("MSB4030"); } @@ -972,7 +972,7 @@ public void ILLink_respects_feature_settings_from_host_config() .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", $"/p:_ExtraTrimmerArgs=--action link {referenceProjectName}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1005,7 +1005,7 @@ public void ILLink_ignores_host_config_settings_with_link_false() .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", $"/p:_ExtraTrimmerArgs=--action link {referenceProjectName}").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1036,12 +1036,12 @@ public void ILLink_runs_incrementally(string targetFramework) var linkSemaphore = Path.Combine(intermediateLinkDir, "Link.semaphore"); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreFirstModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); WaitForUtcNowToAdvance(); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreSecondModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); semaphoreFirstModifiedTime.Should().Be(semaphoreSecondModifiedTime); @@ -1061,7 +1061,7 @@ public void ILLink_old_defaults_keep_nonframework(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1097,7 +1097,7 @@ public void ILLink_net7_defaults_trim_nonframework() var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1144,7 +1144,7 @@ public void ILLink_does_not_include_leftover_artifacts_on_second_run(string targ var linkSemaphore = Path.Combine(intermediateLinkDir, "Link.semaphore"); // Link, keeping classlib - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreFirstModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); var publishedDllKeptFirstTimeOnly = Path.Combine(publishDirectory, $"{referenceProjectName}.dll"); @@ -1161,7 +1161,7 @@ public void ILLink_does_not_include_leftover_artifacts_on_second_run(string targ testAsset = testAsset.WithProjectChanges(project => RemoveRootDescriptor(project)); // Link, discarding classlib - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreSecondModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); // Check that the linker actually ran again @@ -1187,7 +1187,7 @@ public void ILLink_keeps_symbols_by_default(string targetFramework) .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1220,7 +1220,7 @@ public void ILLink_removes_symbols_when_debugger_support_is_disabled(string targ .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:DebuggerSupport=false").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:DebuggerSupport=false").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1248,7 +1248,7 @@ public void ILLink_accepts_option_to_remove_symbols(string targetFramework) .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:TrimmerRemoveSymbols=true").Should().Pass(); + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:TrimmerRemoveSymbols=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1276,7 +1276,7 @@ public void ILLink_symbols_option_can_override_defaults_from_debugger_support(st .WithProjectChanges(project => EnableNonFrameworkTrimming(project)); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:DebuggerSupport=false", "/p:TrimmerRemoveSymbols=false").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; @@ -1308,7 +1308,7 @@ public void ILLink_can_treat_warnings_as_errors(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:WarningsAsErrors=IL2075") .Should().Fail() .And.HaveStdOutContaining("error IL2075") @@ -1327,7 +1327,7 @@ public void ILLink_can_treat_warnings_not_as_errors(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:TreatWarningsAsErrors=true", "/p:EnableTrimAnalyzer=false") .Should().Fail() .And.HaveStdOutContaining("warning IL2026") @@ -1351,7 +1351,7 @@ public void ILLink_can_ignore_warnings(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:NoWarn=IL2075", "/p:WarnAsError=IL2075") .Should().Pass() .And.NotHaveStdOutContaining("warning IL2075") @@ -1370,7 +1370,7 @@ public void ILLink_respects_analysis_level(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:AnalysisLevel=0.0") .Should().Pass().And.NotHaveStdOutMatching(@"warning IL\d\d\d\d"); } @@ -1386,7 +1386,7 @@ public void ILLink_respects_warning_level_independently(string targetFramework) var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", // This tests the linker only. The analyzer doesn't respect ILLinkWarningLevel. "/p:EnableTrimAnalyzer=false", "/p:ILLinkWarningLevel=0") @@ -1405,7 +1405,7 @@ public void ILLink_can_treat_warnings_as_errors_independently(string targetFrame var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:TreatWarningsAsErrors=true", "/p:ILLinkTreatWarningsAsErrors=false", "/p:EnableTrimAnalyzer=false") .Should().Pass() .And.HaveStdOutContaining("warning IL2026") @@ -1446,7 +1446,7 @@ public void ILLink_displays_informational_warning_up_to_net5_by_default(string t var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") .Should().Pass().And.HaveStdOutContainingIgnoreCase("https://aka.ms/dotnet-illink"); } @@ -1463,7 +1463,7 @@ public void ILLink_displays_informational_warning_when_trim_analysis_warnings_ar var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:SuppressTrimAnalysisWarnings=true") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SuppressTrimAnalysisWarnings=true") .Should().Pass().And.HaveStdOutContainingIgnoreCase("https://aka.ms/dotnet-illink") .And.HaveStdOutContainingIgnoreCase("This process might take a while"); } @@ -1481,7 +1481,7 @@ public void ILLink_dont_display_informational_warning_by_default_on_net6plus(str var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") .Should().Pass().And.NotHaveStdErrContaining("https://aka.ms/dotnet-illink") .And.HaveStdOutContainingIgnoreCase("This process might take a while"); } @@ -1499,10 +1499,10 @@ public void ILLink_dont_display_time_awareness_message_on_incremental_build(stri var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") .Should().Pass().And.HaveStdOutContainingIgnoreCase("This process might take a while"); - publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true") + publishCommand.Execute("/p:PublishTrimmed=true", $"/p:RuntimeIdentifier={rid}") .Should().Pass().And.NotHaveStdErrContaining("This process might take a while"); } @@ -1873,7 +1873,7 @@ private TestProject CreateTestProjectWithIsTrimmableAttributes( IsExe = true }; testProject.AdditionalProperties["PublishTrimmed"] = "true"; - + testProject.AdditionalProperties["SelfContained"] = "true"; testProject.SourceFiles[$"{projectName}.cs"] = @" using System; public class Program @@ -1982,7 +1982,7 @@ private TestProject CreateTestProjectForILLinkTesting( TargetFrameworks = targetFramework, IsExe = true }; - + testProject.AdditionalProperties["SelfContained"] = "true"; testProject.SourceFiles[$"{mainProjectName}.cs"] = @" using System; public class Program diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj index 261ff0b4f046..4d4b91c6c3a8 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj @@ -14,7 +14,7 @@ false - + true From 3c6c89fa896b1f38bb99a6c67cfa0429f13bf445 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 27 Jan 2023 12:00:09 -0800 Subject: [PATCH 23/60] Add SelfContained where needed still in IL Link --- .../TestProjects/TrimmedAppWithReferences/App/App.csproj | 1 + .../Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj b/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj index cc105f746d4f..41c2eaa9f450 100644 --- a/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj +++ b/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj @@ -5,6 +5,7 @@ $(CurrentTargetFramework) true false + True diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 9884e8ea45b9..c9246803a888 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -1405,7 +1405,7 @@ public void ILLink_can_treat_warnings_as_errors_independently(string targetFrame var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); - publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", + publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true", "/p:PublishTrimmed=true", "/p:SuppressTrimAnalysisWarnings=false", "/p:TreatWarningsAsErrors=true", "/p:ILLinkTreatWarningsAsErrors=false", "/p:EnableTrimAnalyzer=false") .Should().Pass() .And.HaveStdOutContaining("warning IL2026") @@ -1798,6 +1798,7 @@ private TestProject CreateTestProjectWithAnalysisWarnings(string targetFramework IsExe = isExe }; + testProject.AdditionalProperties["SelfContained"] = "true"; // Don't error when generators/analyzers can't be loaded. // This can occur when running tests against FullFramework MSBuild // if the build machine has an MSBuild install with an older version of Roslyn From 561553c26be3748aaafbe66e29ad880c002daecf Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 27 Jan 2023 14:00:08 -0800 Subject: [PATCH 24/60] Fix remaining IL Link Tests with the new change to not add SelfContained everywhere so we only add it in tests that should pass --- .../GivenThatWeWantToRunILLink.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index c9246803a888..505de513c4c3 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -1423,7 +1423,7 @@ public void ILLink_error_on_portable_app(string targetFramework) var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; - var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); + var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName, setSelfContained: false); var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); var publishCommand = new PublishCommand(testAsset); @@ -1558,15 +1558,17 @@ public void Build_respects_IsTrimmable_property(string targetFramework, bool isE var testProject = CreateTestProjectWithAnalysisWarnings(targetFramework, projectName, isExe); testProject.AdditionalProperties["IsTrimmable"] = "true"; + var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); + testProject.AdditionalProperties["RuntimeIdentifier"] = rid; var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework + isExe); var buildCommand = new BuildCommand(testAsset); // IsTrimmable enables analysis warnings during build - buildCommand.Execute() + buildCommand.Execute("/bl") .Should().Pass() .And.HaveStdOutMatching("warning IL2026.*Program.IL_2026.*Testing analysis warning IL2026"); - var outputDirectory = buildCommand.GetOutputDirectory(targetFramework).FullName; + var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: rid).FullName; var assemblyPath = Path.Combine(outputDirectory, $"{projectName}.dll"); var runtimeConfigPath = Path.Combine(outputDirectory, $"{projectName}.runtimeconfig.json"); @@ -1975,7 +1977,8 @@ private TestProject CreateTestProjectForILLinkTesting( [CallerMemberName] string callingMethod = "", string referenceProjectIdentifier = null, Action modifyReferencedProject = null, - bool addAssemblyReference = false) + bool addAssemblyReference = false, + bool setSelfContained = true) { var testProject = new TestProject() { @@ -1983,7 +1986,12 @@ private TestProject CreateTestProjectForILLinkTesting( TargetFrameworks = targetFramework, IsExe = true }; - testProject.AdditionalProperties["SelfContained"] = "true"; + + if (setSelfContained) + { + testProject.AdditionalProperties["SelfContained"] = "true"; + } + testProject.SourceFiles[$"{mainProjectName}.cs"] = @" using System; public class Program From 9d718456d082d8a1a8960b71ea9c3f9660be4e61 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 24 Apr 2023 16:07:27 -0700 Subject: [PATCH 25/60] Imply SC for some publish properties as we decided to in the partner sync --- .../Microsoft.NET.RuntimeIdentifierInference.targets | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 0b3ef22f77dc..7fa3299b4705 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 @@ -61,6 +61,16 @@ Copyright (c) .NET Foundation. All rights reserved. win7-x86 + + true + @@ -149,7 +159,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_SelfContainedWasSpecified Condition="'$(SelfContained)' != ''">true - + true false From 1dc3859038a4a9ea8fad499e5f2df4b579b49350 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 24 Apr 2023 16:14:43 -0700 Subject: [PATCH 26/60] Remove the binlog added to a test --- .../Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 15f96983a661..ed7109ea9846 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -1564,7 +1564,7 @@ public void Build_respects_IsTrimmable_property(string targetFramework, bool isE var buildCommand = new BuildCommand(testAsset); // IsTrimmable enables analysis warnings during build - buildCommand.Execute("/bl") + buildCommand.Execute() .Should().Pass() .And.HaveStdOutMatching("warning IL2026.*Program.IL_2026.*Testing analysis warning IL2026"); From 03a510504e7f0ad8cfe23ff1502187095d622c30 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 24 Apr 2023 16:42:26 -0700 Subject: [PATCH 27/60] update xlf and add test for publish property inference behavior --- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 6 +-- .../Common/Resources/xlf/Strings.pt-BR.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 6 +-- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 6 +-- .../Common/Resources/xlf/Strings.zh-Hans.xlf | 6 +-- .../Common/Resources/xlf/Strings.zh-Hant.xlf | 6 +-- .../RuntimeIdentifiersTests.cs | 41 +++++++++++++++++++ 14 files changed, 80 insertions(+), 39 deletions(-) diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index a051076ddb8a..432c569255f9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 447b7cc202df..f53a4afdc404 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 1683e4b2a1e8..8da725ba410a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index ef802eab4452..7461a28c9cb1 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 3de0f0a4942c..aa206e6bdead 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 879c6448a320..3f4ec7f2f38c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 630d3fa6c3ca..886c26811970 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 82dd37c1235b..b16f25420050 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index d504a55a7a06..af31d83a0af9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 42ecfe0a5b8d..26135a974db6 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 7f8c82705655..fa92452280cc 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 2cbdcc83bdbf..b82418f2153a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index ccbda2df4a57..c60e94e8b363 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -791,9 +791,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1198: For projects with TargetFramework >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1198: "} + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1199: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs index ff15f6958207..1133713195e4 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs @@ -271,6 +271,47 @@ public void PublishRuntimeIdentifierOverridesUseCurrentRuntime() Assert.True(ucrRid != finalRid); } + [Theory] + [InlineData("PublishReadyToRun", true)] + [InlineData("PublishSingleFile", true)] + [InlineData("PublishTrimmed", true)] + [InlineData("PublishAot", true)] + [InlineData("PublishReadyToRun", false)] + [InlineData("PublishSingleFile", false)] + [InlineData("PublishTrimmed", false)] + public void DesiredPublishPropertiesImplySelfContainedForFrameworkDepedentDefaultFrameworks(string property, bool useFrameworkDependentDefaultTargetFramework) + { + var tfm = useFrameworkDependentDefaultTargetFramework ? ToolsetInfo.CurrentTargetFramework : "net7.0"; // net 7 is the last non FDD default TFM at the time of this PR. + var testProject = new TestProject() + { + IsExe = true, + TargetFrameworks = tfm, + }; + testProject.AdditionalProperties[property] = "true"; + + testProject.RecordProperties("SelfContained"); + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: $"{property}-{useFrameworkDependentDefaultTargetFramework}"); + + var publishCommand = new DotnetPublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + publishCommand + .Execute() + .Should() + .Pass(); + + var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: tfm); + + var expectedSelfContainedValue = "true"; + if ( + (property == "PublishReadyToRun" && useFrameworkDependentDefaultTargetFramework) || // This property should no longer infer SelfContained in net 8 + (property == "PublishTrimmed" && !useFrameworkDependentDefaultTargetFramework) // This property did not infer SelfContained until net 8 + ) + { + expectedSelfContainedValue = ""; + } + + properties["SelfContained"].Should().Be(expectedSelfContainedValue); + } + [Fact] public void ImplicitRuntimeIdentifierOptOutCorrectlyOptsOut() { From ef50ea613a01544e00fdbead8fa82d48fc3b1e1d Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 24 Apr 2023 17:00:06 -0700 Subject: [PATCH 28/60] fix bad msbuild syntax --- ...oft.NET.RuntimeIdentifierInference.targets | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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 5e0ed1ec6ab3..cc507ef907fc 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 @@ -62,14 +62,17 @@ Copyright (c) .NET Foundation. All rights reserved. - true + + true + + @@ -344,4 +347,5 @@ Copyright (c) .NET Foundation. All rights reserved. + From 7d7f707bd93f4e2de9eab5d3806bb4792f7de4a1 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Apr 2023 11:34:19 -0700 Subject: [PATCH 29/60] fix path too long in test --- ...oft.NET.RuntimeIdentifierInference.targets | 3 ++- .../RuntimeIdentifiersTests.cs | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) 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 cc507ef907fc..ecc2b9af5817 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 @@ -64,7 +64,8 @@ Copyright (c) .NET Foundation. All rights reserved. Date: Tue, 25 Apr 2023 11:59:43 -0700 Subject: [PATCH 30/60] make the tests pass by recollecting that sc still infers rid --- .../GlobalPropertyFlowTests.cs | 26 ++++++++++++------- .../RuntimeIdentifiersTests.cs | 4 +-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index cc0a40c1fb94..bc0139dba0b0 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -98,9 +98,9 @@ public void TestGlobalPropertyFlowToExe(bool passSelfContained, bool passRuntime _referencedProject.IsExe = true; var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); + bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); } @@ -118,8 +118,10 @@ public void TestGlobalPropertyFlowToExeWithSelfContainedFalse(bool passSelfConta var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); + bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); } @@ -135,8 +137,10 @@ public void TestGlobalPropertyFlowToLibraryWithRuntimeIdentifier(bool passSelfCo var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, expectedRuntimeIdentifier: passRuntimeIdentifier ? "" : _referencedProject.RuntimeIdentifier); } @@ -173,13 +177,15 @@ public void TestGlobalPropertyFlowToMultitargetedProject(bool passSelfContained, { var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, targetFramework: "net6.0"); - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, targetFramework: "net7.0"); ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false, targetFramework: "net6.0"); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier, + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, targetFramework: "net7.0"); } } diff --git a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs index cc015944a6fd..986dff7f6b18 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs @@ -297,14 +297,14 @@ public void SomePublishPropertiesInferSelfContained(string property, bool useFra if (property == "PublishTrimmed" && !useFrameworkDependentDefaultTargetFramework) { publishCommand - .Execute("-bl:C:\\users\\noahgilson\\whydoespublishaotfail.binlog") + .Execute() .Should() .Fail(); } else { publishCommand - .Execute("-bl:C:\\users\\noahgilson\\whydoespublishaotfail.binlog") + .Execute() .Should() .Pass(); } From 704490ef616a0e9d57bad0bfcb0d8051c19b837b Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Apr 2023 14:08:52 -0700 Subject: [PATCH 31/60] fix global property flow tests to acc for new behaviour again --- .../GlobalPropertyFlowTests.cs | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index bc0139dba0b0..f63f9e5d51bd 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -84,7 +84,9 @@ public void TestGlobalPropertyFlowToLibrary(bool passSelfContained, bool passRun { var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: passRuntimeIdentifier); + bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false); } @@ -98,7 +100,9 @@ public void TestGlobalPropertyFlowToExe(bool passSelfContained, bool passRuntime _referencedProject.IsExe = true; var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); + bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); } @@ -140,8 +144,9 @@ public void TestGlobalPropertyFlowToLibraryWithRuntimeIdentifier(bool passSelfCo bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, - expectedRuntimeIdentifier: passRuntimeIdentifier ? "" : _referencedProject.RuntimeIdentifier); + // We added a rid to the referenced project so it should have one always. + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: true, + expectedRuntimeIdentifier: passRuntimeIdentifier ? EnvironmentInfo.GetCompatibleRid() : _referencedProject.RuntimeIdentifier); } [RequiresMSBuildVersionTheory("17.4.0.41702")] @@ -162,32 +167,20 @@ public void TestGlobalPropertyFlowToMultitargetedProject(bool passSelfContained, string identifier = passSelfContained.ToString() + "_" + passRuntimeIdentifier; - if (!passSelfContained && passRuntimeIdentifier) - { - var testAsset = _testAssetsManager.CreateTestProject(_testProject, identifier: identifier); - - new DotnetBuildCommand(testAsset, "-r", EnvironmentInfo.GetCompatibleRid()) - .Execute() - .Should() - .Fail() - .And - .HaveStdOutContaining("NETSDK1150"); - } - else - { var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); + // in net 7 or below this means to build self contained but not in net8 as the properties are independent. bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained, + thisTargetFramework: "net6.0"); ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, - targetFramework: "net6.0"); - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, - targetFramework: "net7.0"); + thisTargetFramework: ToolsetInfo.CurrentTargetFramework); ; ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false, - targetFramework: "net6.0"); + thisTargetFramework: "net6.0"); ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, - targetFramework: "net7.0"); - } + thisTargetFramework: ToolsetInfo.CurrentTargetFramework); + } [RequiresMSBuildVersionTheory("17.4.0.41702", Skip = "https://github.com/dotnet/msbuild/issues/8154")] @@ -242,11 +235,13 @@ public void TestGlobalPropertyFlowInSolution(bool passSelfContained, bool passRu } } - private static void ValidateProperties(TestAsset testAsset, TestProject testProject, bool expectSelfContained, bool expectRuntimeIdentifier, string targetFramework = null, string expectedRuntimeIdentifier = "") + private static void ValidateProperties(TestAsset testAsset, TestProject testProject, bool expectSelfContained, bool expectRuntimeIdentifier, string thisTargetFramework = null, string expectedRuntimeIdentifier = "") { - targetFramework = targetFramework ?? testProject.TargetFrameworks; + thisTargetFramework = thisTargetFramework ?? testProject.TargetFrameworks; + + var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: thisTargetFramework); + - var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: targetFramework); if (expectSelfContained) { properties["SelfContained"].ToLowerInvariant().Should().Be("true"); From d20b51077d7a5bc58f6666d078e1db513114895f Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Apr 2023 14:14:42 -0700 Subject: [PATCH 32/60] Make the framework reference flow in a test by adding self contained explicitly --- src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs index fc1bf1171660..93795ed1cb3e 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs @@ -830,6 +830,8 @@ public void ResolvedFrameworkReferences_are_generated() RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid() }; + testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.FrameworkReferences.Add("Microsoft.AspNetCore.App"); testProject.FrameworkReferences.Add("Microsoft.WindowsDesktop.App"); From e16385b69ad96443b5efc207ac5fe47e38a9dd11 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Apr 2023 14:18:14 -0700 Subject: [PATCH 33/60] remove selfcontained added to test lib because it should get inferred --- src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj b/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj index 41c2eaa9f450..cc105f746d4f 100644 --- a/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj +++ b/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj @@ -5,7 +5,6 @@ $(CurrentTargetFramework) true false - True From 3ea20a3143735fa6d2005bc2d7e647863f932699 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Apr 2023 14:48:03 -0700 Subject: [PATCH 34/60] add empty targetframeworkversion check --- .../targets/Microsoft.NET.RuntimeIdentifierInference.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ecc2b9af5817..2cfddd7ad8cf 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 @@ -165,7 +165,7 @@ Copyright (c) .NET Foundation. All rights reserved. true + '$(_TargetFrameworkVersionWithoutV)' != '' and '$(_TargetFrameworkVersionWithoutV)' < '8.0'">true false <_RuntimeIdentifierUsesAppHost Condition="$(RuntimeIdentifier.StartsWith('ios')) or $(RuntimeIdentifier.StartsWith('tvos')) or $(RuntimeIdentifier.StartsWith('maccatalyst')) or $(RuntimeIdentifier.StartsWith('android')) or $(RuntimeIdentifier.StartsWith('browser'))">false <_RuntimeIdentifierUsesAppHost Condition="'$(_RuntimeIdentifierUsesAppHost)' == ''">true From 6bc5a454df3882c2b923710d77b0f191941e1bd5 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Apr 2023 15:11:27 -0700 Subject: [PATCH 35/60] update xlf --- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 412 +++++++++--------- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 6 +- .../Common/Resources/xlf/Strings.pt-BR.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 6 +- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 6 +- .../Common/Resources/xlf/Strings.zh-Hans.xlf | 6 +- .../Common/Resources/xlf/Strings.zh-Hant.xlf | 6 +- 13 files changed, 242 insertions(+), 242 deletions(-) diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index e21883b24197..67085e621a62 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 75cc26560da2..36342fcd97ec 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 64845b1c4ab6..2ee0b0ce1e86 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index df0a1dddd737..7876b1266c54 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 422d0c481bc3..42ccaad13c04 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 1e2f43af3fd3..39843358b4a4 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -4,52 +4,52 @@ NETSDK1076: AddResource can only be used with integer resource types. - NETSDK1076: AddResource は、整数のリソースの種類でのみ使用できます。 + NETSDK1076: AddResource can only be used with integer resource types. {StrBegin="NETSDK1076: "} NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true. - NETSDK1183: Ahead Of Time コンパイル用にアセンブリを最適化できません: 有効なランタイム パッケージが見つかりませんでした。PublishAot プロパティを false に設定するか、公開時に、サポートされているランタイム識別子を使用してください。.NET 7 以降を対象とする場合は、必ず PublishAot プロパティを true に設定してパッケージを復元してください。 + NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true. {StrBegin="NETSDK1183: "} NETSDK1196: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false. - NETSDK1195: SDK は Ahead Of Time コンパイルをサポートしていません。PublishAot プロパティを false に設定してください。 + NETSDK1196: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false. {StrBegin="NETSDK1196: "} NETSDK1070: The application configuration file must have root configuration element. - NETSDK1070: アプリケーション構成ファイルには、ルート構成要素が必要です。 + NETSDK1070: The application configuration file must have root configuration element. {StrBegin="NETSDK1070: "} NETSDK1113: Failed to create apphost (attempt {0} out of {1}): {2} - NETSDK1113: apphost を作成できませんでした ({1} 回中 {0} 回目の試行): {2} + NETSDK1113: Failed to create apphost (attempt {0} out of {1}): {2} {StrBegin="NETSDK1113: "} NETSDK1074: The application host executable will not be customized because adding resources requires that the build be performed on Windows (excluding Nano Server). - NETSDK1074: リソースの追加ではビルドが Windows 上で実行される必要があるため、アプリケーション ホストの実行可能ファイルはカスタマイズされません (Nano Server を除く)。 + NETSDK1074: The application host executable will not be customized because adding resources requires that the build be performed on Windows (excluding Nano Server). {StrBegin="NETSDK1074: "} NETSDK1029: Unable to use '{0}' as application host executable as it does not contain the expected placeholder byte sequence '{1}' that would mark where the application name would be written. - NETSDK1029: '{0}' は、本来アプリケーション名が書き込まれる場所を示す、必要なプレースホルダー バイト シーケンス '{1}' が含まれていないため、実行可能アプリケーション ホストとして使用できません。 + NETSDK1029: Unable to use '{0}' as application host executable as it does not contain the expected placeholder byte sequence '{1}' that would mark where the application name would be written. {StrBegin="NETSDK1029: "} NETSDK1078: Unable to use '{0}' as application host executable because it's not a Windows PE file. - NETSDK1078: Windows PE ファイルではないため、'{0}' をアプリケーション ホストの実行可能ファイルとして使用することはできません。 + NETSDK1078: Unable to use '{0}' as application host executable because it's not a Windows PE file. {StrBegin="NETSDK1078: "} NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem. - NETSDK1072: CUI (コンソール) サブシステム用の Windows 実行可能ファイルではないため、'{0}' をアプリケーション ホストの実行可能ファイルとして使用することはできません。 + NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem. {StrBegin="NETSDK1072: "} NETSDK1177: Failed to sign apphost with error code {1}: {0} - NETSDK1177: エラー コード {1} が発生して AppHost に署名できませんでした: {0} + NETSDK1177: Failed to sign apphost with error code {1}: {0} {StrBegin="NETSDK1177: "} @@ -59,167 +59,167 @@ NETSDK1079: The Microsoft.AspNetCore.All package is not supported when targeting .NET Core 3.0 or higher. A FrameworkReference to Microsoft.AspNetCore.App should be used instead, and will be implicitly included by Microsoft.NET.Sdk.Web. - NETSDK1079: .NET Core 3.0 以上がターゲットの場合、Microsoft.AspNetCore.All パッケージはサポートされていません。代わりに Microsoft.AspNetCore.App への FrameworkReference を使用する必要があり、これは Microsoft.NET.Sdk.Web によって暗黙的に含まれます。 + NETSDK1079: The Microsoft.AspNetCore.All package is not supported when targeting .NET Core 3.0 or higher. A FrameworkReference to Microsoft.AspNetCore.App should be used instead, and will be implicitly included by Microsoft.NET.Sdk.Web. {StrBegin="NETSDK1079: "} NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher. If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference should be replaced with a FrameworkReference. - NETSDK1080: .NET Core 3.0 以上がターゲットの場合、Microsoft.AspNetCore.App への PackageReference は必要ありません。Microsoft.NET.Sdk.Web が使用される場合、この共有フレームワークは自動的に参照されます。そうでない場合、PackageReference を FrameworkReference で置き換える必要があります。 + NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher. If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference should be replaced with a FrameworkReference. {StrBegin="NETSDK1080: "} NETSDK1017: Asset preprocessor must be configured before assets are processed. - NETSDK1017: 資産を処理する前に、資産プリプロセッサを構成する必要があります。 + NETSDK1017: Asset preprocessor must be configured before assets are processed. {StrBegin="NETSDK1017: "} NETSDK1047: Assets file '{0}' doesn't have a target for '{1}'. Ensure that restore has run and that you have included '{2}' in the TargetFrameworks for your project. You may also need to include '{3}' in your project's RuntimeIdentifiers. - NETSDK1047: 資産ファイル '{0}' に '{1}' のターゲットがありません。復元が実行されたこと、および '{2}' がプロジェクトの TargetFrameworks に含まれていることを確認してください。プロジェクトの RuntimeIdentifiers に '{3}' を組み込む必要が生じる可能性もあります。 + NETSDK1047: Assets file '{0}' doesn't have a target for '{1}'. Ensure that restore has run and that you have included '{2}' in the TargetFrameworks for your project. You may also need to include '{3}' in your project's RuntimeIdentifiers. {StrBegin="NETSDK1047: "} NETSDK1005: Assets file '{0}' doesn't have a target for '{1}'. Ensure that restore has run and that you have included '{2}' in the TargetFrameworks for your project. - NETSDK1005: 資産ファイル '{0}' に '{1}' のターゲットがありません。復元が実行されたことと、'{2}' がプロジェクトの TargetFrameworks に含まれていることを確認してください。 + NETSDK1005: Assets file '{0}' doesn't have a target for '{1}'. Ensure that restore has run and that you have included '{2}' in the TargetFrameworks for your project. {StrBegin="NETSDK1005: "} NETSDK1004: Assets file '{0}' not found. Run a NuGet package restore to generate this file. - NETSDK1004: 資産ファイル '{0}' が見つかりません。NuGet パッケージの復元を実行して、このファイルを生成してください。 + NETSDK1004: Assets file '{0}' not found. Run a NuGet package restore to generate this file. {StrBegin="NETSDK1004: "} NETSDK1063: The path to the project assets file was not set. Run a NuGet package restore to generate this file. - NETSDK1063: プロジェクト資産ファイルのパスが設定されていません。NuGet パッケージの復元を実行して、このファイルを生成してください。 + NETSDK1063: The path to the project assets file was not set. Run a NuGet package restore to generate this file. {StrBegin="NETSDK1063: "} NETSDK1006: Assets file path '{0}' is not rooted. Only full paths are supported. - NETSDK1006: 資産ファイル パス '{0}' にルートが指定されていません。完全パスのみがサポートされます。 + NETSDK1006: Assets file path '{0}' is not rooted. Only full paths are supported. {StrBegin="NETSDK1006: "} NETSDK1001: At least one possible target framework must be specified. - NETSDK1001: 可能性のあるターゲット フレームワークを少なくとも 1 つ指定する必要があります。 + NETSDK1001: At least one possible target framework must be specified. {StrBegin="NETSDK1001: "} + + NETSDK1125: Publishing to a single-file is only supported for netcoreapp target. + NETSDK1125: Publishing to a single-file is only supported for netcoreapp target. + {StrBegin="NETSDK1125: "} + NETSDK1092: The CLSIDMap cannot be embedded on the COM host because adding resources requires that the build be performed on Windows (excluding Nano Server). - NETSDK1092: リソースの追加にはビルドが Windows 上で実行されることが要求されるため、CLSIDMap を COM ホストに埋め込むことはできません (Nano Server を除く)。 + NETSDK1092: The CLSIDMap cannot be embedded on the COM host because adding resources requires that the build be performed on Windows (excluding Nano Server). {StrBegin="NETSDK1092: "} NETSDK1065: Cannot find app host for {0}. {0} could be an invalid runtime identifier (RID). For more information about RID, see https://aka.ms/rid-catalog. - NETSDK1065: {0} のアプリ ホストが見つかりません。{0} は無効なランタイム識別子 (RID) である可能性があります。RID の詳細については、https://aka.ms/rid-catalog をご覧ください。 + NETSDK1065: Cannot find app host for {0}. {0} could be an invalid runtime identifier (RID). For more information about RID, see https://aka.ms/rid-catalog. {StrBegin="NETSDK1065: "} NETSDK1091: Unable to find a .NET Core COM host. The .NET Core COM host is only available on .NET Core 3.0 or higher when targeting Windows. - NETSDK1091: .NET Core COM ホストが見つかりません。Windows がターゲットの場合、.NET Core COM ホストを利用できるのは .NET Core 3.0 以上の場合のみです。 + NETSDK1091: Unable to find a .NET Core COM host. The .NET Core COM host is only available on .NET Core 3.0 or higher when targeting Windows. {StrBegin="NETSDK1091: "} NETSDK1114: Unable to find a .NET Core IJW host. The .NET Core IJW host is only available on .NET Core 3.1 or higher when targeting Windows. - NETSDK1114: .NET Core IJW ホストが見つかりません。Windows がターゲットの場合、.NET Core IJW ホストを利用できるのは .NET Core 3.1 以上の場合のみです。 + NETSDK1114: Unable to find a .NET Core IJW host. The .NET Core IJW host is only available on .NET Core 3.1 or higher when targeting Windows. {StrBegin="NETSDK1114: "} NETSDK1007: Cannot find project info for '{0}'. This can indicate a missing project reference. - NETSDK1007: '{0}' のプロジェクト情報が見つかりません。これは、プロジェクト参照がないことを示している可能性があります。 + NETSDK1007: Cannot find project info for '{0}'. This can indicate a missing project reference. {StrBegin="NETSDK1007: "} NETSDK1032: The RuntimeIdentifier platform '{0}' and the PlatformTarget '{1}' must be compatible. - NETSDK1032: RuntimeIdentifier プラットフォーム '{0}' と PlatformTarget '{1}' には互換性が必要です。 + NETSDK1032: The RuntimeIdentifier platform '{0}' and the PlatformTarget '{1}' must be compatible. {StrBegin="NETSDK1032: "} NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false. - NETSDK1031: RuntimeIdentifier を指定せずに自己完結型アプリケーションをビルドおよび公開することはサポートされていません。RuntimeIdentifier を指定するか SelfContained を false に設定する必要があります。 + NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false. {StrBegin="NETSDK1031: "} - - NETSDK1097: It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set PublishSingleFile to false. - NETSDK1097: RuntimeIdentifier を指定せずにアプリケーションを単一ファイルに公開することはサポートされていません。RuntimeIdentifier を指定するか、PublishSingleFile を false に設定する必要があります。 - {StrBegin="NETSDK1097: "} - NETSDK1098: Applications published to a single-file are required to use the application host. You must either set PublishSingleFile to false or set UseAppHost to true. - NETSDK1098: 単一ファイルに公開されたアプリケーションでは、アプリケーション ホストを使用する必要があります。PublishSingleFile を false に設定するか、UseAppHost を true に設定する必要があります。 + NETSDK1098: Applications published to a single-file are required to use the application host. You must either set PublishSingleFile to false or set UseAppHost to true. {StrBegin="NETSDK1098: "} NETSDK1099: Publishing to a single-file is only supported for executable applications. - NETSDK1099: 単一ファイルへの公開は実行可能アプリケーションに対してのみサポートされています。 + NETSDK1099: Publishing to a single-file is only supported for executable applications. {StrBegin="NETSDK1099: "} + + NETSDK1097: It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set PublishSingleFile to false. + NETSDK1097: It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set PublishSingleFile to false. + {StrBegin="NETSDK1097: "} + NETSDK1194: The "--output" option isn't supported when building a solution. Specifying a solution-level output path results in all projects copying outputs to the same directory, which can lead to inconsistent builds. - NETSDK1194: ソリューションのビルド時に "--output" オプションはサポートされていません。ソリューション レベルの出力パスを指定すると、すべてのプロジェクトで出力が同じディレクトリにコピーされ、ビルドの一貫性が失われる可能性があります。 + NETSDK1194: The "--output" option isn't supported when building a solution. Specifying a solution-level output path results in all projects copying outputs to the same directory, which can lead to inconsistent builds. {StrBegin="NETSDK1194: "} NETSDK1134: Building a solution with a specific RuntimeIdentifier is not supported. If you would like to publish for a single RID, specify the RID at the individual project level instead. - NETSDK1134: 特定の RuntimeIdentifier を使用したソリューションのビルドはサポートされていません。単一の RID に対して発行する場合は、個々のプロジェクト レベルで RID を指定してください。 + NETSDK1134: Building a solution with a specific RuntimeIdentifier is not supported. If you would like to publish for a single RID, specify the RID at the individual project level instead. {StrBegin="NETSDK1134: "} NETSDK1135: SupportedOSPlatformVersion {0} cannot be higher than TargetPlatformVersion {1}. - NETSDK1135: SupportedOSPlatformVersion {0} を TargetPlatformVersion {1} より大きくすることはできません。 + NETSDK1135: SupportedOSPlatformVersion {0} cannot be higher than TargetPlatformVersion {1}. {StrBegin="NETSDK1135: "} NETSDK1143: Including all content in a single file bundle also includes native libraries. If IncludeAllContentForSelfExtract is true, IncludeNativeLibrariesForSelfExtract must not be false. - NETSDK1143: 単一のファイル バンドルにすべてのコンテンツを含めると、ネイティブ ライブラリも含まれます。IncludeAllContentForSelfExtract が true の場合、IncludeNativeLibrariesForSelfExtract を false にすることはできません。 + NETSDK1143: Including all content in a single file bundle also includes native libraries. If IncludeAllContentForSelfExtract is true, IncludeNativeLibrariesForSelfExtract must not be false. {StrBegin="NETSDK1143: "} NETSDK1142: Including symbols in a single file bundle is not supported when publishing for .NET5 or higher. - NETSDK1142: .NET5 以降に対してパブリッシュする場合、単一のファイル バンドルにシンボルを含めることはサポートされていません。 + NETSDK1142: Including symbols in a single file bundle is not supported when publishing for .NET5 or higher. {StrBegin="NETSDK1142: "} NETSDK1013: The TargetFramework value '{0}' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. - NETSDK1013: TargetFramework 値 '{0}' が認識されませんでした。つづりが間違っている可能性があります。間違っていない場合は、TargetFrameworkIdentifier または TargetFrameworkVersion プロパティ (あるいはその両方) を明示的に指定する必要があります。 + NETSDK1013: The TargetFramework value '{0}' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. {StrBegin="NETSDK1013: "} NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true. - NETSDK1067: アプリケーション ホストを使用するには、自己完結型のアプリケーションが必要です。SelfContained を false に設定するか、UseAppHost を true に設定してください。 + NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true. {StrBegin="NETSDK1067: "} - - NETSDK1125: Publishing to a single-file is only supported for netcoreapp target. - NETSDK1125: 1 つのファイルへの発行は netcoreapp ターゲットでのみサポートされています。 - {StrBegin="NETSDK1125: "} - Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. - AssemblyVersion '{1}' が '{2}' より大きいため、'{0}' を選択しています。 + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Choosing '{0}' arbitrarily as both items are copy-local and have equal file and assembly versions. - 両方の項目がローカル コピーであり、ファイルとアセンブリのバージョンが等しいため、'{0}' を任意に選択しています。 + Choosing '{0}' arbitrarily as both items are copy-local and have equal file and assembly versions. Choosing '{0}' because file version '{1}' is greater than '{2}'. - ファイルのバージョン '{1}' が '{2}' より大きいため、'{0}' を選択しています。 + Choosing '{0}' because file version '{1}' is greater than '{2}'. Choosing '{0}' because it is a platform item. - '{0}' はプラットフォーム項目であるため、これを選択しています。 + Choosing '{0}' because it is a platform item. Choosing '{0}' because it comes from a package that is preferred. - '{0}' は優先されるパッケージからのものであるため、これを選択しています。 + Choosing '{0}' because it comes from a package that is preferred. NETSDK1089: The '{0}' and '{1}' types have the same CLSID '{2}' set in their GuidAttribute. Each COMVisible class needs to have a distinct guid for their CLSID. - NETSDK1089: 型 '{0}' および '{1}' では、GuidAttribute で同じ CLSID '{2}' が設定されています。各 COMVisible クラスでは、CLSID に異なる guid が設定されている必要があります。 + NETSDK1089: The '{0}' and '{1}' types have the same CLSID '{2}' set in their GuidAttribute. Each COMVisible class needs to have a distinct guid for their CLSID. {StrBegin="NETSDK1089: "} {0} - The first type with the conflicting guid. {1} - The second type with the conflicting guid. @@ -227,241 +227,241 @@ NETSDK1088: The COMVisible class '{0}' must have a GuidAttribute with the CLSID of the class to be made visible to COM in .NET Core. - NETSDK1088: COMVisible クラス '{0}' を .NET Core 内の COM に対して参照可能にするには、クラスの CLSID を持つ GuidAttribute を含める必要があります。 + NETSDK1088: The COMVisible class '{0}' must have a GuidAttribute with the CLSID of the class to be made visible to COM in .NET Core. {StrBegin="NETSDK1088: "} {0} - The ComVisible class that doesn't have a GuidAttribute on it. NETSDK1090: The supplied assembly '{0}' is not valid. Cannot generate a CLSIDMap from it. - NETSDK1090: 指定されたアセンブリ '{0}' が無効です。CLSIDMap を生成できません。 + NETSDK1090: The supplied assembly '{0}' is not valid. Cannot generate a CLSIDMap from it. {StrBegin="NETSDK1090: "} {0} - The path to the invalid assembly. NETSDK1167: Compression in a single file bundle is only supported when publishing for .NET6 or higher. - NETSDK1167: 単一ファイル バンドルの圧縮は、.NET6 またはそれ以降の発行時にのみサポートされます。 + NETSDK1167: Compression in a single file bundle is only supported when publishing for .NET6 or higher. {StrBegin="NETSDK1167: "} NETSDK1176: Compression in a single file bundle is only supported when publishing a self-contained application. - NETSDK1176: 単一ファイル バンドルの圧縮は、内蔵アプリケーションの発行時にのみサポートされます。 + NETSDK1176: Compression in a single file bundle is only supported when publishing a self-contained application. {StrBegin="NETSDK1176: "} NETSDK1133: There was conflicting information about runtime packs available for {0}: {1} - NETSDK1133: {0} で使用可能なランタイム パックの情報が競合しています: + NETSDK1133: There was conflicting information about runtime packs available for {0}: {1} {StrBegin="NETSDK1133: "} NETSDK1014: Content item for '{0}' sets '{1}', but does not provide '{2}' or '{3}'. - NETSDK1014: '{0}' のコンテンツ項目で '{1}' が設定されていますが、'{2}' または '{3}' は指定されていません。 + NETSDK1014: Content item for '{0}' sets '{1}', but does not provide '{2}' or '{3}'. {StrBegin="NETSDK1014: "} NETSDK1010: The '{0}' task must be given a value for parameter '{1}' in order to consume preprocessed content. - NETSDK1010: 前処理されたコンテンツを使用するためには、パラメーター '{1}' の値を '{0}' タスクに指定する必要があります。 + NETSDK1010: The '{0}' task must be given a value for parameter '{1}' in order to consume preprocessed content. {StrBegin="NETSDK1010: "} Could not determine winner because '{0}' does not exist. - '{0}' が存在しないため勝者を判別できませんでした。 + Could not determine winner because '{0}' does not exist. Could not determine winner due to equal file and assembly versions. - ファイルとアセンブリのバージョンが等しいため、勝者を判別できませんでした。 + Could not determine winner due to equal file and assembly versions. Could not determine a winner because '{0}' has no file version. - '{0}' にファイルのバージョンがないため勝者を判別できませんでした。 + Could not determine a winner because '{0}' has no file version. Could not determine a winner because '{0}' is not an assembly. - '{0}' がアセンブリでないため勝者を判別できませんでした。 + Could not determine a winner because '{0}' is not an assembly. NETSDK1181: Error getting pack version: Pack '{0}' was not present in workload manifests. - NETSDK1181: パックバージョンの取得エラー。パック '{0}' がワークロード マニフェストに存在しませんでした。 + NETSDK1181: Error getting pack version: Pack '{0}' was not present in workload manifests. {StrBegin="NETSDK1181: "} NETSDK1042: Could not load PlatformManifest from '{0}' because it did not exist. - NETSDK1042: 存在しなかったため、'{0}' から PlatformManifest を読み込めませんでした。 + NETSDK1042: Could not load PlatformManifest from '{0}' because it did not exist. {StrBegin="NETSDK1042: "} NETSDK1120: C++/CLI projects targeting .NET Core require a target framework of at least 'netcoreapp3.1'. - NETSDK1120: .NET Core をターゲットとする C++/CLI プロジェクトには、少なくとも 'netcoreapp 3.1' のターゲット フレームワークが必要です。 + NETSDK1120: C++/CLI projects targeting .NET Core require a target framework of at least 'netcoreapp3.1'. {StrBegin="NETSDK1120: "} NETSDK1158: Required '{0}' metadata missing on Crossgen2Tool item. - NETSDK1158: 必要な '{0}' メタデータが Crossgen2Tool 項目にありません。 + NETSDK1158: Required '{0}' metadata missing on Crossgen2Tool item. {StrBegin="NETSDK1158: "} NETSDK1126: Publishing ReadyToRun using Crossgen2 is only supported for self-contained applications. - NETSDK1126: Crossgen2 を使用した ReadyToRun の公開は、自己完結型アプリケーションでのみサポートされています。 + NETSDK1126: Publishing ReadyToRun using Crossgen2 is only supported for self-contained applications. {StrBegin="NETSDK1126: "} NETSDK1155: Crossgen2Tool executable '{0}' not found. - NETSDK1155: Crossgen2Tool 実行可能ファイル '{0}' が見つかりません。 + NETSDK1155: Crossgen2Tool executable '{0}' not found. {StrBegin="NETSDK1155: "} NETSDK1154: Crossgen2Tool must be specified when UseCrossgen2 is set to true. - NETSDK1154: UseCrossgen2 が true に設定されている場合は Crossgen2Tool を指定する必要があります。 + NETSDK1154: Crossgen2Tool must be specified when UseCrossgen2 is set to true. {StrBegin="NETSDK1154: "} NETSDK1166: Cannot emit symbols when publishing for .NET 5 with Crossgen2 using composite mode. - NETSDK1166: 複合モードを使用して Crossgen2 で .NET 5 を対象に発行する場合、シンボルを生成できません。 + NETSDK1166: Cannot emit symbols when publishing for .NET 5 with Crossgen2 using composite mode. {StrBegin="NETSDK1166: "} NETSDK1160: CrossgenTool executable '{0}' not found. - NETSDK1160: CrossgenTool 実行可能ファイル '{0}' が見つかりません。 + NETSDK1160: CrossgenTool executable '{0}' not found. {StrBegin="NETSDK1160: "} NETSDK1153: CrossgenTool not specified in PDB compilation mode. - NETSDK1153: PDB コンパイル モードで CrossgenTool が指定されていません。 + NETSDK1153: CrossgenTool not specified in PDB compilation mode. {StrBegin="NETSDK1153: "} NETSDK1159: CrossgenTool must be specified when UseCrossgen2 is set to false. - NETSDK1159: UseCrossgen2 が false に設定されている場合は CrossgenTool を指定する必要があります。 + NETSDK1159: CrossgenTool must be specified when UseCrossgen2 is set to false. {StrBegin="NETSDK1159: "} NETSDK1161: DiaSymReader library '{0}' not found. - NETSDK1161: DiaSymReader ライブラリ '{0}' が見つかりません。 + NETSDK1161: DiaSymReader library '{0}' not found. {StrBegin="NETSDK1161: "} NETSDK1156: .NET host executable '{0}' not found. - NETSDK1156: .NET ホストの実行可能ファイル '{0}' が見つかりません。 + NETSDK1156: .NET host executable '{0}' not found. {StrBegin="NETSDK1156: "} NETSDK1055: DotnetTool does not support target framework lower than netcoreapp2.1. - NETSDK1055: DotnetTool は、netcoreapp2.1 未満のターゲット フレームワークをサポートしていません。 + NETSDK1055: DotnetTool does not support target framework lower than netcoreapp2.1. {StrBegin="NETSDK1055: "} NETSDK1054: only supports .NET Core. - NETSDK1054: .NET Core のみがサポートされています。 + NETSDK1054: only supports .NET Core. {StrBegin="NETSDK1054: "} NETSDK1022: Duplicate '{0}' items were included. The .NET SDK includes '{0}' items from your project directory by default. You can either remove these items from your project file, or set the '{1}' property to '{2}' if you want to explicitly include them in your project file. For more information, see {4}. The duplicate items were: {3} - NETSDK1022: 重複する '{0}' 個のアイテムが含められました。.NET SDK には、既定でプロジェクト ディレクトリからのアイテムが '{0}' 個含まれています。これらのアイテムをプロジェクト ファイルから削除するか、'{1}' プロパティを '{2}' に設定してプロジェクト ファイルに明示的に含めることができます。詳細については、{4} をご覧ください。重複するアイテムは、{3} でした。 + NETSDK1022: Duplicate '{0}' items were included. The .NET SDK includes '{0}' items from your project directory by default. You can either remove these items from your project file, or set the '{1}' property to '{2}' if you want to explicitly include them in your project file. For more information, see {4}. The duplicate items were: {3} {StrBegin="NETSDK1022: "} NETSDK1015: The preprocessor token '{0}' has been given more than one value. Choosing '{1}' as the value. - NETSDK1015: プリプロセッサ トークン '{0}' に複数の値が指定されています。値として '{1}' を選択します。 + NETSDK1015: The preprocessor token '{0}' has been given more than one value. Choosing '{1}' as the value. {StrBegin="NETSDK1015: "} NETSDK1152: Found multiple publish output files with the same relative path: {0}. - NETSDK1152: 同じ相対パスの発行出力ファイルが複数見つかりました: {0}。 + NETSDK1152: Found multiple publish output files with the same relative path: {0}. {StrBegin="NETSDK1152: "} NETSDK1110: More than one asset in the runtime pack has the same destination sub-path of '{0}'. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. - NETSDK1110: ランタイム パック内の複数のアセットに同じターゲット サブパス '{0}' が指定されています。https://aka.ms/dotnet-sdk-issue で、このエラーを .NET チームに報告してください。 + NETSDK1110: More than one asset in the runtime pack has the same destination sub-path of '{0}'. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. {StrBegin="NETSDK1110: "} NETSDK1169: The same resource ID {0} was specified for two type libraries '{1}' and '{2}'. Duplicate type library IDs are not allowed. - NETSDK1169: 同じリソース ID {0} が2つのタイプ ライブラリ '{1}' と '{2}' に指定されました。タイプ ライブラリ ID の重複は許可されていません。 + NETSDK1169: The same resource ID {0} was specified for two type libraries '{1}' and '{2}'. Duplicate type library IDs are not allowed. {StrBegin="NETSDK1169: "} Encountered conflict between '{0}' and '{1}'. - '{0}' と '{1}' の間で競合が発生しました。 + Encountered conflict between '{0}' and '{1}'. NETSDK1051: Error parsing FrameworkList from '{0}'. {1} '{2}' was invalid. - NETSDK1051: '{0}' からの FrameworkList の解析でエラーが発生しました。{1} '{2}' が無効でした。 + NETSDK1051: Error parsing FrameworkList from '{0}'. {1} '{2}' was invalid. {StrBegin="NETSDK1051: "} NETSDK1043: Error parsing PlatformManifest from '{0}' line {1}. Lines must have the format {2}. - NETSDK1043: '{0}' 行 {1} からの PlatformManifest の解析でエラーが発生しました。行の形式は {2} である必要があります。 + NETSDK1043: Error parsing PlatformManifest from '{0}' line {1}. Lines must have the format {2}. {StrBegin="NETSDK1043: "} NETSDK1044: Error parsing PlatformManifest from '{0}' line {1}. {2} '{3}' was invalid. - NETSDK1044: '{0}' 行 {1} からの PlatformManifest の解析でエラーが発生しました。{2} '{3}' は無効でした。 + NETSDK1044: Error parsing PlatformManifest from '{0}' line {1}. {2} '{3}' was invalid. {StrBegin="NETSDK1044: "} NETSDK1060: Error reading assets file: {0} - NETSDK1060: アセット ファイルの読み取りでエラーが発生しました: {0} + NETSDK1060: Error reading assets file: {0} {StrBegin="NETSDK1060: "} NETSDK1111: Failed to delete output apphost: {0} - NETSDK1111: 出力 apphost を削除できませんでした: {0} + NETSDK1111: Failed to delete output apphost: {0} {StrBegin="NETSDK1111: "} NETSDK1077: Failed to lock resource. - NETSDK1077: リソースをロックできませんでした。 + NETSDK1077: Failed to lock resource. {StrBegin="NETSDK1077: "} NETSDK1030: Given file name '{0}' is longer than 1024 bytes - NETSDK1030: 指定されたファイル名 '{0}' の長さが 1024 バイトを超えています。 + NETSDK1030: Given file name '{0}' is longer than 1024 bytes {StrBegin="NETSDK1030: "} NETSDK1024: Folder '{0}' already exists either delete it or provide a different ComposeWorkingDir - NETSDK1024: フォルダー '{0}' が既に存在します。そのフォルダーを削除するか、別の ComposeWorkingDir を指定してください。 + NETSDK1024: Folder '{0}' already exists either delete it or provide a different ComposeWorkingDir {StrBegin="NETSDK1024: "} NETSDK1068: The framework-dependent application host requires a target framework of at least 'netcoreapp2.1'. - NETSDK1068: フレームワークに依存するアプリケーション ホストには、最低でも 'netcoreapp2.1' のターゲット フレームワークが必要です。 + NETSDK1068: The framework-dependent application host requires a target framework of at least 'netcoreapp2.1'. {StrBegin="NETSDK1068: "} NETSDK1052: Framework list file path '{0}' is not rooted. Only full paths are supported. - NETSDK1052: フレームワーク リスト ファイル パス '{0}' にルートが指定されていません。完全パスのみがサポートされています。 + NETSDK1052: Framework list file path '{0}' is not rooted. Only full paths are supported. {StrBegin="NETSDK1052: "} NETSDK1087: Multiple FrameworkReference items for '{0}' were included in the project. - NETSDK1087: '{0}' に対する複数の FrameworkReference 項目がプロジェクトに含められました。 + NETSDK1087: Multiple FrameworkReference items for '{0}' were included in the project. {StrBegin="NETSDK1087: "} NETSDK1086: A FrameworkReference for '{0}' was included in the project. This is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see {1} - NETSDK1086: '{0}' の FrameworkReference がプロジェクトに含められました。これは .NET SDK によって暗黙的に参照されるため、通常はプロジェクトから参照する必要はありません。詳細については、{1} をご覧ください + NETSDK1086: A FrameworkReference for '{0}' was included in the project. This is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see {1} {StrBegin="NETSDK1086: "} NETSDK1049: Resolved file has a bad image, no metadata, or is otherwise inaccessible. {0} {1} - NETSDK1049: 解決されたファイルは、無効なイメージが含まれているか、メタデータが存在しないか、またはアクセスできません。{0} {1} + NETSDK1049: Resolved file has a bad image, no metadata, or is otherwise inaccessible. {0} {1} {StrBegin="NETSDK1049: "} NETSDK1141: Unable to resolve the .NET SDK version as specified in the global.json located at {0}. - NETSDK1141: {0} にある global.json で指定されている .NET SDK のバージョンを解決できません。 + NETSDK1141: Unable to resolve the .NET SDK version as specified in the global.json located at {0}. {StrBegin="NETSDK1141: "} NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. - NETSDK1144: アセンブリのサイズを最適化できませんでした。PublishTrimmed プロパティを false に設定することにより、最適化を無効にすることができます。 + NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. {StrBegin="NETSDK1144: "} @@ -471,90 +471,90 @@ NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. Please ensure that you are publishing a self-contained app. - NETSDK1102: アセンブリのサイズの最適化は、選択された公開構成に対してはサポートされていません。自己完結型のアプリを公開していることをご確認ください。 + NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. Please ensure that you are publishing a self-contained app. {StrBegin="NETSDK1102: "} Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink - アセンブリのサイズを最適化すると、アプリの動作が変わる可能性があります。公開した後に必ずテストしてください。https://aka.ms/dotnet-illink を参照してください + Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink Optimizing assemblies for size. This process might take a while. - アセンブリのサイズを最適化しています。このプロセスには時間がかかる場合があります。 + Optimizing assemblies for size. This process might take a while. NETSDK1191: A runtime identifier for the property '{0}' couldn't be inferred. Specify a rid explicitly. - NETSDK1191: プロパティ '{0}' のランタイム識別子を推論できませんでした。RID を明示的に指定してください。 + NETSDK1191: A runtime identifier for the property '{0}' couldn't be inferred. Specify a rid explicitly. {StrBegin="NETSDK1191: "} NETSDK1020: Package Root {0} was incorrectly given for Resolved library {1} - NETSDK1020: 解決されたライブラリ {1} に対して指定されたパッケージ ルート {0} が正しくありません。 + NETSDK1020: Package Root {0} was incorrectly given for Resolved library {1} {StrBegin="NETSDK1020: "} NETSDK1025: The target manifest {0} provided is of not the correct format - NETSDK1025: 指定されたターゲット マニフェスト {0} の形式が正しくありません + NETSDK1025: The target manifest {0} provided is of not the correct format {StrBegin="NETSDK1025: "} NETSDK1163: Input assembly '{0}' not found. - NETSDK1163: 入力アセンブリ '{0}' が見つかりません。 + NETSDK1163: Input assembly '{0}' not found. {StrBegin="NETSDK1163: "} NETSDK1003: Invalid framework name: '{0}'. - NETSDK1003: 無効なフレームワーク名: '{0}'。 + NETSDK1003: Invalid framework name: '{0}'. {StrBegin="NETSDK1003: "} NETSDK1058: Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' - NETSDK1058: ItemSpecToUse パラメーターの値が無効です: '{0}'。このプロパティは空白にするか、'Left' または 'Right' に設定する必要があります + NETSDK1058: Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' {StrBegin="NETSDK1058: "} The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right NETSDK1018: Invalid NuGet version string: '{0}'. - NETSDK1018: 無効な NuGet バージョン文字列: '{0}'。 + NETSDK1018: Invalid NuGet version string: '{0}'. {StrBegin="NETSDK1018: "} NETSDK1075: Update handle is invalid. This instance may not be used for further updates. - NETSDK1075: 更新ハンドルが無効です。このインスタンスは、今後の更新には使用できない可能性があります。 + NETSDK1075: Update handle is invalid. This instance may not be used for further updates. {StrBegin="NETSDK1075: "} NETSDK1104: RollForward value '{0}' is invalid. Allowed values are {1}. - NETSDK1104: ロールフォワード値 '{0}' が無効です。許可されている値は {1} です。 + NETSDK1104: RollForward value '{0}' is invalid. Allowed values are {1}. {StrBegin="NETSDK1104: "} NETSDK1140: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: {2} - NETSDK1140: {0} は {1} に対して有効な TargetPlatformVersion ではありません。有効なバージョン: + NETSDK1140: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: {2} {StrBegin="NETSDK1140: "} NETSDK1173: The provided type library '{0}' is in an invalid format. - NETSDK1173: 指定済みのタイプ ライブラリ '{0}' の形式が無効です。 + NETSDK1173: The provided type library '{0}' is in an invalid format. {StrBegin="NETSDK1173: "} NETSDK1170: The provided type library ID '{0}' for type library '{1}' is invalid. The ID must be a positive integer less than 65536. - NETSDK1170: タイプ ライブラリ '{1}' の指定されたタイプ ライブラリ ID '{0}' が無効です。ID は 65536 未満の正の整数である必要があります。 + NETSDK1170: The provided type library ID '{0}' for type library '{1}' is invalid. The ID must be a positive integer less than 65536. {StrBegin="NETSDK1170: "} NETSDK1157: JIT library '{0}' not found. - NETSDK1157: JIT ライブラリ '{0}' が見つかりません。 + NETSDK1157: JIT library '{0}' not found. {StrBegin="NETSDK1157: "} 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 を参照してください。 + 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. {StrBegin="NETSDK1061: "} {0} - Package Identifier for platform package {1} - Restored version of platform package @@ -562,272 +562,272 @@ The following are names of parameters or literal values and should not be transl NETSDK1008: Missing '{0}' metadata on '{1}' item '{2}'. - NETSDK1008: '{1}' 項目 '{2}' の '{0}' メタデータがありません。 + NETSDK1008: Missing '{0}' metadata on '{1}' item '{2}'. {StrBegin="NETSDK1008: "} NETSDK1164: Missing output PDB path in PDB generation mode (OutputPDBImage metadata). - NETSDK1164: PDB 生成モードの出力 PDB パス (OutputPDBImage メタデータ) がありません。 + NETSDK1164: Missing output PDB path in PDB generation mode (OutputPDBImage metadata). {StrBegin="NETSDK1164: "} NETSDK1165: Missing output R2R image path (OutputR2RImage metadata). - NETSDK1165: 出力 R2R イメージ パス (OutputR2RImage メタデータ) がありません。 + NETSDK1165: Missing output R2R image path (OutputR2RImage metadata). {StrBegin="NETSDK1165: "} NETSDK1171: An integer ID less than 65536 must be provided for type library '{0}' because more than one type library is specified. - NETSDK1171: タイプ ライブラリ '{0}' に複数のタイプ ライブラリが指定されているため、65536 未満の整数の ID を指定する必要があります。 + NETSDK1171: An integer ID less than 65536 must be provided for type library '{0}' because more than one type library is specified. {StrBegin="NETSDK1171: "} NETSDK1021: More than one file found for {0} - NETSDK1021: {0} で複数のファイルが見つかりました。 + NETSDK1021: More than one file found for {0} {StrBegin="NETSDK1021: "} NETSDK1069: This project uses a library that targets .NET Standard 1.5 or higher, and the project targets a version of .NET Framework that doesn't have built-in support for that version of .NET Standard. Visit https://aka.ms/net-standard-known-issues for a set of known issues. Consider retargeting to .NET Framework 4.7.2. - NETSDK1069: このプロジェクトは .NET Standard 1.5 以上をターゲットとするライブラリを使用します。また、このプロジェクトは、そのバージョンの .NET Standard に対するサポートが組み込まれていない .NET Framework のバージョンをターゲットとしています。一連の既知の問題について、https://aka.ms/net-standard-known-issues をご覧ください。.NET Framework 4.7.2 への再ターゲットを検討してください。 + NETSDK1069: This project uses a library that targets .NET Standard 1.5 or higher, and the project targets a version of .NET Framework that doesn't have built-in support for that version of .NET Standard. Visit https://aka.ms/net-standard-known-issues for a set of known issues. Consider retargeting to .NET Framework 4.7.2. {StrBegin="NETSDK1069: "} NETSDK1115: The current .NET SDK does not support .NET Framework without using .NET SDK Defaults. It is likely due to a mismatch between C++/CLI project CLRSupport property and TargetFramework. - NETSDK1115: 現在の .NET SDK では、.NET SDK の既定値を使用せずに .NET Framework をサポートすることはできません。これは、C++/CLI プロジェクトの CLRSupport プロパティと TargetFramework の間の不一致が原因と考えられます。 + NETSDK1115: The current .NET SDK does not support .NET Framework without using .NET SDK Defaults. It is likely due to a mismatch between C++/CLI project CLRSupport property and TargetFramework. {StrBegin="NETSDK1115: "} NETSDK1182: Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported. - NETSDK1182: Visual Studio 2019 では .NET 6.0 以降をターゲットにすることはできません。 + NETSDK1182: Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported. {StrBegin="NETSDK1182: "} NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported. - NETSDK1192: Visual Studio 2022 17.3 では .NET 7.0 以上をターゲットにすることはできません。 + NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported. {StrBegin="NETSDK1192: "} NETSDK1084: There is no application host available for the specified RuntimeIdentifier '{0}'. - NETSDK1084: 指定された RuntimeIdentifier '{0}' で利用できるアプリケーション ホストはありません。 + NETSDK1084: There is no application host available for the specified RuntimeIdentifier '{0}'. {StrBegin="NETSDK1084: "} NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. - NETSDK1085: 'NoBuild' プロパティが true に設定されていますが、'Build' ターゲットが呼び出されました。 + NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. {StrBegin="NETSDK1085: "} NETSDK1002: Project '{0}' targets '{2}'. It cannot be referenced by a project that targets '{1}'. - NETSDK1002: プロジェクト '{0}' は、'{2}' を対象としています。'{1}' を対象とするプロジェクトは、これを参照できません。 + NETSDK1002: Project '{0}' targets '{2}'. It cannot be referenced by a project that targets '{1}'. {StrBegin="NETSDK1002: "} NETSDK1082: There was no runtime pack for {0} available for the specified RuntimeIdentifier '{1}'. - NETSDK1082: 指定された RuntimeIdentifier '{1}' で利用できる {0} のランタイム パックがありませんでした。 + NETSDK1082: There was no runtime pack for {0} available for the specified RuntimeIdentifier '{1}'. {StrBegin="NETSDK1082: "} NETSDK1132: No runtime pack information was available for {0}. - NETSDK1132: {0} で使用可能なランタイム パックの情報がありません。 + NETSDK1132: No runtime pack information was available for {0}. {StrBegin="NETSDK1132: "} NETSDK1128: COM hosting does not support self-contained deployments. - NETSDK1128: COM ホスティングは自己完結型の配置をサポートしていません。 + NETSDK1128: COM hosting does not support self-contained deployments. {StrBegin="NETSDK1128: "} NETSDK1119: C++/CLI projects targeting .NET Core cannot use EnableComHosting=true. - NETSDK1119: .NET Core をターゲットとする C++/CLI プロジェクトでは EnableComHosting=true を使用できません。 + NETSDK1119: C++/CLI projects targeting .NET Core cannot use EnableComHosting=true. {StrBegin="NETSDK1119: "} NETSDK1116: C++/CLI projects targeting .NET Core must be dynamic libraries. - NETSDK1116: .NET Core をターゲットとする C++/CLI プロジェクトは、ダイナミック ライブラリである必要があります。 + NETSDK1116: C++/CLI projects targeting .NET Core must be dynamic libraries. {StrBegin="NETSDK1116: "} NETSDK1118: C++/CLI projects targeting .NET Core cannot be packed. - NETSDK1118: .NET Core をターゲットとする C++/CLI プロジェクトはパックできません。 + NETSDK1118: C++/CLI projects targeting .NET Core cannot be packed. {StrBegin="NETSDK1118: "} NETSDK1117: Does not support publish of C++/CLI project targeting dotnet core. - NETSDK1117: .NET Core をターゲットとする C++/CLI プロジェクトの発行をサポートしていません。 + NETSDK1117: Does not support publish of C++/CLI project targeting dotnet core. {StrBegin="NETSDK1117: "} NETSDK1121: C++/CLI projects targeting .NET Core cannot use SelfContained=true. - NETSDK1121: .NET Core をターゲットとする C++/CLI プロジェクトでは SelfContained=true を使用できません。 + NETSDK1121: C++/CLI projects targeting .NET Core cannot use SelfContained=true. {StrBegin="NETSDK1121: "} NETSDK1151: The referenced project '{0}' is a self-contained executable. A self-contained executable cannot be referenced by a non self-contained executable. For more information, see https://aka.ms/netsdk1151 - NETSDK1151: 参照先プロジェクト '{0}' は自己完結型実行可能ファイルです。 自己完結型の実行可能ファイルは、自己完結型以外の実行可能ファイルでは参照できません。詳細については、「https://aka.ms/netsdk1151」を参照してください + NETSDK1151: The referenced project '{0}' is a self-contained executable. A self-contained executable cannot be referenced by a non self-contained executable. For more information, see https://aka.ms/netsdk1151 {StrBegin="NETSDK1151: "} NETSDK1162: PDB generation: R2R executable '{0}' not found. - NETSDK1162: PDB 生成: R2R 実行可能ファイル '{0}' が見つかりません。 + NETSDK1162: PDB generation: R2R executable '{0}' not found. {StrBegin="NETSDK1162: "} NETSDK1053: Pack as tool does not support self contained. - NETSDK1053: Pack As ツールは自己完結型をサポートしていません。 + NETSDK1053: Pack as tool does not support self contained. {StrBegin="NETSDK1053: "} NETSDK1146: PackAsTool does not support TargetPlatformIdentifier being set. For example, TargetFramework cannot be net5.0-windows, only net5.0. PackAsTool also does not support UseWPF or UseWindowsForms when targeting .NET 5 and higher. - NETSDK1146: PackAsTool は、設定されている TargetPlatformIdentifier をサポートしていません。たとえば、TargetFramework には net5.0-windows は指定できず、net 5.0 のみ使用できます。また PackAsTool は、.NET 5 以降を対象としている場合には、UseWPF や UseWindowsForms もサポートしていません。 + NETSDK1146: PackAsTool does not support TargetPlatformIdentifier being set. For example, TargetFramework cannot be net5.0-windows, only net5.0. PackAsTool also does not support UseWPF or UseWindowsForms when targeting .NET 5 and higher. {StrBegin="NETSDK1146: "} NETSDK1187: Package {0} {1} has a resource with the locale '{2}'. This locale has been normalized to the standard format '{3}' to prevent casing issues in the build. Consider notifying the package author about this casing issue. - NETSDK1187: パッケージ {0} {1} にロケール '{2}' のリソースがあります。大文字と小文字の区別に関する問題を防ぐために、このロケールはビルド内では標準形式 '{3}' に正規化されています。大文字と小文字の区別に関する問題があることをパッケージの作成者に通知するようお勧めします。 + NETSDK1187: Package {0} {1} has a resource with the locale '{2}'. This locale has been normalized to the standard format '{3}' to prevent casing issues in the build. Consider notifying the package author about this casing issue. Error code is NETSDK1187. 0 is a package name, 1 is a package version, 2 is the incorrect locale string, and 3 is the correct locale string. NETSDK1188: Package {0} {1} has a resource with the locale '{2}'. This locale is not recognized by .NET. Consider notifying the package author that it appears to be using an invalid locale. - NETSDK1188: パッケージ {0} {1} にロケール '{2}' のリソースがあります。このロケールは .NET では認識されません。無効なロケールを使用していると思われることをパッケージ作成者に通知するようお勧めします。 + NETSDK1188: Package {0} {1} has a resource with the locale '{2}'. This locale is not recognized by .NET. Consider notifying the package author that it appears to be using an invalid locale. Error code is NETSDK1188. 0 is a package name, 1 is a package version, and 2 is the incorrect locale string NETSDK1064: Package {0}, version {1} was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. - NETSDK1064: パッケージ {0}、バージョン {1} が見つかりませんでした。NuGet の復元により、削除された可能性があります。それ以外の場合、NuGet の復元が最大パス長の制限のために一部分しか完了していない可能性があります。 + NETSDK1064: Package {0}, version {1} was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. {StrBegin="NETSDK1064: "} NETSDK1023: A PackageReference for '{0}' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see {1} - NETSDK1023: '{0}' の PackageReference がプロジェクトに含められました。このパッケージは .NET SDK によって暗黙的に参照されるため、通常はプロジェクトから参照する必要がありません。詳細については、{1} をご覧ください。 + NETSDK1023: A PackageReference for '{0}' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see {1} {StrBegin="NETSDK1023: "} NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs - NETSDK1071: '{0}' への PackageReference は '{1}' のバージョンを指定しました。このパッケージのバージョンを指定することは推奨されません。詳細については、https://aka.ms/sdkimplicitrefs を参照してください + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs {StrBegin="NETSDK1071: "} NETSDK1174: Placeholder - NETSDK1174: プレースホルダー + NETSDK1174: Placeholder {StrBegin="NETSDK1174: "} - This string is not used here, but is a placeholder for the error code, which is used by the "dotnet run" command. NETSDK1189: Prefer32Bit is not supported and has no effect for netcoreapp target. - NETSDK1189: Prefer32Bit はサポートされておらず、netcoreapp ターゲットには影響しません。 + NETSDK1189: Prefer32Bit is not supported and has no effect for netcoreapp target. {StrBegin="NETSDK1189: "} NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'. - NETSDK1011: プロジェクト '{0}' の資産が使用されますが、対応する MSBuild プロジェクト パスが '{1}' で見つかりませんでした。 + NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'. {StrBegin="NETSDK1011: "} NETSDK1059: The tool '{0}' is now included in the .NET SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box). - NETSDK1059: ツール '{0}' は .NET SDK に含まれるようになりました。この警告の解決に関する情報は、(https://aka.ms/dotnetclitools-in-box) で入手できます。 + NETSDK1059: The tool '{0}' is now included in the .NET SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box). {StrBegin="NETSDK1059: "} NETSDK1093: Project tools (DotnetCliTool) only support targeting .NET Core 2.2 and lower. - NETSDK1093: プロジェクト ツール (DotnetCliTool) は、ターゲットが .NET Core 2.2 以下の場合のみサポートされます。 + NETSDK1093: Project tools (DotnetCliTool) only support targeting .NET Core 2.2 and lower. {StrBegin="NETSDK1093: "} NETSDK1198: A publish profile with the name '{0}' was not found in the project. Set the PublishProfile property to a valid file name. - NETSDK1198: '{0}' という名前の発行プロファイルがプロジェクトに見つかりませんでした。PublishProfile プロパティを有効なファイル名に設定してください。 + NETSDK1198: A publish profile with the name '{0}' was not found in the project. Set the PublishProfile property to a valid file name. {StrBegin="NETSDK1198: "} NETSDK1122: ReadyToRun compilation will be skipped because it is only supported for .NET Core 3.0 or higher. - NETSDK1122: ReadyToRun コンパイルは、.NET Core 3.0 以降でのみサポートされているため、スキップされます。 + NETSDK1122: ReadyToRun compilation will be skipped because it is only supported for .NET Core 3.0 or higher. {StrBegin="NETSDK1122: "} NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained が設定されている場合、true または false のいずれかにする必要があります。指定された値は '{0}' でした。 + NETSDK1193: If PublishSelfContained is set, it 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 以降が必要です。 + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. {StrBegin="NETSDK1123: "} NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. - NETSDK1124: アセンブリをトリミングするには、.NET Core 3.0 以降が必要です。 + NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. {StrBegin="NETSDK1124: "} NETSDK1129: The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, you must specify the framework for the published application. - NETSDK1129: ターゲット フレームワークを指定しないと、'Publish' ターゲットはサポートされません。現在のプロジェクトは複数のフレームワークを対象としています。発行するアプリケーションのフレームワークを指定する必要があります。 + NETSDK1129: The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, you must specify the framework for the published application. {StrBegin="NETSDK1129: "} NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. - NETSDK1096: アセンブリのパフォーマンスの最適化が失敗しました。失敗したアセンブリを最適化の対象から除外するか、PublishReadyToRun プロパティを false に設定してください。 + NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. {StrBegin="NETSDK1096: "} Some ReadyToRun compilations emitted warnings, indicating potential missing dependencies. Missing dependencies could potentially cause runtime failures. To show the warnings, set the PublishReadyToRunShowWarnings property to true. - 一部の ReadyToRun コンパイルで警告が発生しました。これは、依存関係が見つからないことを示している可能性があります。依存関係が見つからないと、ランタイム エラーが発生する場合があります。警告を表示するには、PublishReadyToRunShowWarnings プロパティを true に設定します。 + Some ReadyToRun compilations emitted warnings, indicating potential missing dependencies. Missing dependencies could potentially cause runtime failures. To show the warnings, set the PublishReadyToRunShowWarnings property to true. NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing and make sure to restore packages with the PublishReadyToRun property set to true. - NETSDK1094: アセンブリのパフォーマンスを最適化できません: 有効なランタイム パッケージが見つかりませんでした。PublishReadyToRun プロパティを false に設定するか、公開時に、サポートされているランタイム識別子を使用してください。.NET 6 以降を対象とする場合は、必ず PublishReadyToRun プロパティを true に設定してパッケージを復元してください。 + NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing and make sure to restore packages with the PublishReadyToRun property set to true. {StrBegin="NETSDK1094: "} NETSDK1095: Optimizing assemblies for performance is not supported for the selected target platform or architecture. Please verify you are using a supported runtime identifier, or set the PublishReadyToRun property to false. - NETSDK1095: アセンブリのパフォーマンスの最適化は、選択されたターゲット プラットフォームまたはアーキテクチャに対してはサポートされていません。サポートされているランタイム識別子を使用していることを確認するか、PublishReadyToRun プロパティを false に設定してください。 + NETSDK1095: Optimizing assemblies for performance is not supported for the selected target platform or architecture. Please verify you are using a supported runtime identifier, or set the PublishReadyToRun property to false. {StrBegin="NETSDK1095: "} NETSDK1103: RollForward setting is only supported on .NET Core 3.0 or higher. - NETSDK1103: ロールフォワードの設定は、.NET Core 3.0 以降でのみサポートされています。 + NETSDK1103: RollForward setting is only supported on .NET Core 3.0 or higher. {StrBegin="NETSDK1103: "} NETSDK1083: The specified RuntimeIdentifier '{0}' is not recognized. - NETSDK1083: 指定された RuntimeIdentifier '{0}' は認識されていません。 + NETSDK1083: The specified RuntimeIdentifier '{0}' is not recognized. {StrBegin="NETSDK1083: "} NETSDK1028: Specify a RuntimeIdentifier - NETSDK1028: RuntimeIdentifier の指定 + NETSDK1028: Specify a RuntimeIdentifier {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. - NETSDK1109: ランタイム リスト ファイル '{0}' が見つかりませんでした。https://aka.ms/dotnet-sdk-issue で、このエラーを .NET チームに報告してください。 + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. {StrBegin="NETSDK1109: "} NETSDK1112: The runtime pack for {0} was not downloaded. Try running a NuGet restore with the RuntimeIdentifier '{1}'. - NETSDK1112: {0} のランタイム パックがダウンロードされませんでした。RuntimeIdentifier '{1}' で NuGet 復元を実行してみてください。 + NETSDK1112: The runtime pack for {0} was not downloaded. Try running a NuGet restore with the RuntimeIdentifier '{1}'. {StrBegin="NETSDK1112: "} NETSDK1185: The Runtime Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true. - NETSDK1185: FrameworkReference '{0}' のランタイム パックは使用できませんでした。DisableTransitiveFrameworkReferenceDownloads が true に設定されたことが原因である可能性があります。 + NETSDK1185: The Runtime Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true. {StrBegin="NETSDK1185: "} NETSDK1150: The referenced project '{0}' is a non self-contained executable. A non self-contained executable cannot be referenced by a self-contained executable. For more information, see https://aka.ms/netsdk1150 - NETSDK1150: 参照先プロジェクト '{0}' は自己完結型以外の実行可能ファイルです。 自己完結型以外の実行可能ファイルは、自己完結型の実行可能ファイルでは参照できません。詳細については、「https://aka.ms/netsdk1150」を参照してください + NETSDK1150: The referenced project '{0}' is a non self-contained executable. A non self-contained executable cannot be referenced by a self-contained executable. For more information, see https://aka.ms/netsdk1150 {StrBegin="NETSDK1150: "} NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. - NETSDK1179: '--runtime' を使用する場合は、'--self-contained' または '--no-self-contained' オプションのいずれかが必要です。 + NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. {StrBegin="NETSDK1179: "} NETSDK1048: 'AdditionalProbingPaths' were specified for GenerateRuntimeConfigurationFiles, but are being skipped because 'RuntimeConfigDevPath' is empty. - NETSDK1048: 'AdditionalProbingPaths' が GenerateRuntimeConfigurationFiles に指定されましたが、'RuntimeConfigDevPath' が空であるためスキップされます。 + NETSDK1048: 'AdditionalProbingPaths' were specified for GenerateRuntimeConfigurationFiles, but are being skipped because 'RuntimeConfigDevPath' is empty. {StrBegin="NETSDK1048: "} @@ -839,107 +839,107 @@ The following are names of parameters or literal values and should not be transl NETSDK1138: The target framework '{0}' is out of support and will not receive security updates in the future. Please refer to {1} for more information about the support policy. - NETSDK1138: ターゲット フレームワーク '{0}' はサポートされていません。今後、セキュリティ更新プログラムを受け取ることはありません。サポート ポリシーの詳細については、{1} をご覧ください。 + NETSDK1138: The target framework '{0}' is out of support and will not receive security updates in the future. Please refer to {1} for more information about the support policy. {StrBegin="NETSDK1138: "} NETSDK1046: The TargetFramework value '{0}' is not valid. To multi-target, use the 'TargetFrameworks' property instead. - NETSDK1046: TargetFramework 値 '{0}' が無効です。複数をターゲットとするには、代わりに 'TargetFrameworks' プロパティを使用してください。 + NETSDK1046: The TargetFramework value '{0}' is not valid. To multi-target, use the 'TargetFrameworks' property instead. {StrBegin="NETSDK1046: "} NETSDK1145: The {0} pack is not installed and NuGet package restore is not supported. Upgrade Visual Studio, remove global.json if it specifies a certain SDK version, and uninstall the newer SDK. For more options visit https://aka.ms/targeting-apphost-pack-missing Pack Type:{0}, Pack directory: {1}, targetframework: {2}, Pack PackageId: {3}, Pack Package Version: {4} - NETSDK1145: {0} パックはインストールされておらず、NuGet パッケージの復元はサポートされていません。Visual Studio をアップグレードして、global.json を削除し (特定の SDK バージョンがそれに指定されている場合)、より新しい SDK をアンインストールします。その他のオプションについては、https://aka.ms/targeting-apphost-pack-missing にアクセスしてください。パックの種類: {0}、パック ディレクトリ: {1}、targetframework: {2}、パックの PackageId: {3}、パック パッケージ バージョン: {4} + NETSDK1145: The {0} pack is not installed and NuGet package restore is not supported. Upgrade Visual Studio, remove global.json if it specifies a certain SDK version, and uninstall the newer SDK. For more options visit https://aka.ms/targeting-apphost-pack-missing Pack Type:{0}, Pack directory: {1}, targetframework: {2}, Pack PackageId: {3}, Pack Package Version: {4} {StrBegin="NETSDK1145: "} NETSDK1127: The targeting pack {0} is not installed. Please restore and try again. - NETSDK1127: ターゲット パック {0} がインストールされていません。復元して、もう一度お試しください。 + NETSDK1127: The targeting pack {0} is not installed. Please restore and try again. {StrBegin="NETSDK1127: "} NETSDK1184: The Targeting Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true. - NETSDK1184: FrameworkReference '{0}' の Targeting Pack は使用できませんでした。DisableTransitiveFrameworkReferenceDownloads が true に設定されたことが原因である可能性があります。 + NETSDK1184: The Targeting Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true. {StrBegin="NETSDK1184: "} NETSDK1175: Windows Forms is not supported or recommended with trimming enabled. Please go to https://aka.ms/dotnet-illink/windows-forms for more details. - NETSDK1175: Windows フォームに関して、トリミングの有効化はサポートおよび推奨されていません。詳細については、https://aka.ms/dotnet-illink/windows-forms を参照してください。 + NETSDK1175: Windows Forms is not supported or recommended with trimming enabled. Please go to https://aka.ms/dotnet-illink/windows-forms for more details. {StrBegin="NETSDK1175: "} NETSDK1168: WPF is not supported or recommended with trimming enabled. Please go to https://aka.ms/dotnet-illink/wpf for more details. - NETSDK1168: WPF に関して、トリミングの有効化はサポートおよび推奨されていません。詳細については、https://aka.ms/dotnet-illink/wpf を参照してください。 + NETSDK1168: WPF is not supported or recommended with trimming enabled. Please go to https://aka.ms/dotnet-illink/wpf for more details. {StrBegin="NETSDK1168: "} NETSDK1172: The provided type library '{0}' does not exist. - NETSDK1172: 指定済みのタイプ ライブラリ '{0}' は存在しません。 + NETSDK1172: The provided type library '{0}' does not exist. {StrBegin="NETSDK1172: "} NETSDK1016: Unable to find resolved path for '{0}'. - NETSDK1016: 解決された '{0}' のパスが見つかりません。 + NETSDK1016: Unable to find resolved path for '{0}'. {StrBegin="NETSDK1016: "} Unable to use package assets cache due to I/O error. This can occur when the same project is built more than once in parallel. Performance may be degraded, but the build result will not be impacted. - I/O エラーのため、パッケージ資産のキャッシュを使用できません。これは、同じプロジェクトが同時に複数回ビルドされるときに発生することがあります。パフォーマンスが低下する可能性がありますが、ビルドの結果には影響はありません。 + Unable to use package assets cache due to I/O error. This can occur when the same project is built more than once in parallel. Performance may be degraded, but the build result will not be impacted. NETSDK1012: Unexpected file type for '{0}'. Type is both '{1}' and '{2}'. - NETSDK1012: '{0}' のファイルの種類が正しくありません。種類は '{1}' と '{2}' の両方です。 + NETSDK1012: Unexpected file type for '{0}'. Type is both '{1}' and '{2}'. {StrBegin="NETSDK1012: "} NETSDK1073: The FrameworkReference '{0}' was not recognized - NETSDK1073: FrameworkReference '{0}' は認識されませんでした + NETSDK1073: The FrameworkReference '{0}' was not recognized {StrBegin="NETSDK1073: "} NETSDK1186: This project depends on Maui Essentials through a project or NuGet package reference, but doesn't declare that dependency explicitly. To build this project, you must set the UseMauiEssentials property to true (and install the Maui workload if necessary). - NETSDK1186: このプロジェクトでは、プロジェクトまたは NuGet パッケージ参照を介して Maui Essentials に依存していますが、その依存関係が明示的に宣言されていません。このプロジェクトをビルドするには、UseMauiEssentials プロパティを true に設定する必要があります (必要に応じて、Maui ワークロードをインストールしてください)。 + NETSDK1186: This project depends on Maui Essentials through a project or NuGet package reference, but doesn't declare that dependency explicitly. To build this project, you must set the UseMauiEssentials property to true (and install the Maui workload if necessary). {StrBegin="NETSDK1186: "} NETSDK1137: It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'. - NETSDK1137: Microsoft.NET.Sdk.WindowsDesktop SDK を使用する必要はなくなりました。ルート プロジェクト要素の SDK 属性を 'Microsoft.NET.Sdk' に変更することをご検討ください。 + NETSDK1137: It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'. {StrBegin="NETSDK1137: "} NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. - NETSDK1009: 認識されないプリプロセッサ トークン '{0}' が '{1}' に存在します。 + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. {StrBegin="NETSDK1009: "} NETSDK1081: The targeting pack for {0} was not found. You may be able to resolve this by running a NuGet restore on the project. - NETSDK1081: {0} の Targeting Pack が見つかりませんでした。プロジェクトで NuGet の復元を実行することにより、この問題を解決できる場合があります。 + NETSDK1081: The targeting pack for {0} was not found. You may be able to resolve this by running a NuGet restore on the project. {StrBegin="NETSDK1081: "} NETSDK1019: {0} is an unsupported framework. - NETSDK1019: {0} は、サポートされていないフレームワークです。 + NETSDK1019: {0} is an unsupported framework. {StrBegin="NETSDK1019: "} NETSDK1056: Project is targeting runtime '{0}' but did not resolve any runtime-specific packages. This runtime may not be supported by the target framework. - NETSDK1056: プロジェクトはランタイム '{0}' をターゲットとしていますが、ランタイム固有のパッケージを解決しませんでした。このランタイムはターゲットのフレームワークでサポートされていない可能性があります。 + NETSDK1056: Project is targeting runtime '{0}' but did not resolve any runtime-specific packages. This runtime may not be supported by the target framework. {StrBegin="NETSDK1056: "} NETSDK1050: The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. - NETSDK1050: このプロジェクトで使用される Microsoft.NET.Sdk のバージョンは、.NET Standard 1.5 以上を対象とするライブラリへの参照をサポートするには不十分です。.NET Core SDK のバージョン 2.0 以上をインストールしてください。 + NETSDK1050: The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. {StrBegin="NETSDK1050: "} NETSDK1045: The current .NET SDK does not support targeting {0} {1}. Either target {0} {2} or lower, or use a version of the .NET SDK that supports {0} {1}. - NETSDK1045: 現在の .NET SDK は、ターゲットとする {0} {1} をサポートしていません。{0} {2} 以下をターゲットとするか、{0} {1} をサポートする .NET SDK のバージョンを使用してください。 + NETSDK1045: The current .NET SDK does not support targeting {0} {1}. Either target {0} {2} or lower, or use a version of the .NET SDK that supports {0} {1}. {StrBegin="NETSDK1045: "} NETSDK1139: The target platform identifier {0} was not recognized. - NETSDK1139: ターゲット プラットフォーム識別子 {0} は認識されませんでした。 + NETSDK1139: The target platform identifier {0} was not recognized. {StrBegin="NETSDK1139: "} @@ -949,66 +949,66 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK. - NETSDK1107: Windows デスクトップ アプリケーションを作成するには、Microsoft.NET.Sdk.WindowsDesktop が必要です。現在の SDK では、'UseWpf' と 'UseWindowsForms' はサポートされていません。 + NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK. {StrBegin="NETSDK1107: "} NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy - NETSDK1057: プレビュー版の .NET を使用しています。https://aka.ms/dotnet-support-policy をご覧ください + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1131: Producing a managed Windows Metadata component with WinMDExp is not supported when targeting {0}. - NETSDK1131: {0} をターゲットにする場合、WinMDExp を使用したマネージド Windows メタデータ コンポーネント生成はサポートされていません。 + NETSDK1131: Producing a managed Windows Metadata component with WinMDExp is not supported when targeting {0}. {StrBegin="NETSDK1131: "} NETSDK1130: {1} cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130 - NETSDK1130: {1} 参照できません。.NET 5 以上のターゲットを設定する場合、Windows Metadata コンポーネントを直接参照することはできません。詳細については、 「https://aka.ms/netsdk1130」をご参照ください。 + NETSDK1130: {1} cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130 {StrBegin="NETSDK1130: "} NETSDK1149: {0} cannot be referenced because it uses built-in support for WinRT, which is no longer supported in .NET 5 and higher. An updated version of the component supporting .NET 5 is needed. For more information, see https://aka.ms/netsdk1149 - NETSDK1149: NET 5 以上でサポートされなくなった WinRT に組み込みのサポートが使用されている可能性があり、{0}は参照できません。.NET 5 をサポートしているコンポーネントの更新バージョンが必要です。詳細については、「 https://aka.ms/netsdk1149」をご参照ください。 + NETSDK1149: {0} cannot be referenced because it uses built-in support for WinRT, which is no longer supported in .NET 5 and higher. An updated version of the component supporting .NET 5 is needed. For more information, see https://aka.ms/netsdk1149 {StrBegin="NETSDK1149: "} NETSDK1106: Microsoft.NET.Sdk.WindowsDesktop requires 'UseWpf' or 'UseWindowsForms' to be set to 'true' - NETSDK1106: Microsoft.NET.Sdk.WindowsDesktop では、'UseWpf' または 'UseWindowsForms' を 'true' に設定する必要があります + NETSDK1106: Microsoft.NET.Sdk.WindowsDesktop requires 'UseWpf' or 'UseWindowsForms' to be set to 'true' {StrBegin="NETSDK1106: "} NETSDK1105: Windows desktop applications are only supported on .NET Core 3.0 or higher. - NETSDK1105: Windows デスクトップ アプリケーションは、.NET Core 3.0 以降でのみサポートされています。 + NETSDK1105: Windows desktop applications are only supported on .NET Core 3.0 or higher. {StrBegin="NETSDK1105: "} NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. - NETSDK1100: このオペレーティング システムで Windows を対象とするプロジェクトをビルドするには、EnableWindowsTargeting プロパティを true に設定します。 + NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. {StrBegin="NETSDK1100: "} NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so. - NETSDK1136: Windows フォームまたは WPF を使用しているとき、またはそのようなプロジェクトまたはパッケージを参照しているときには、ターゲット プラットフォームを Windows に設定する必要があります (通常は TargetFramework プロパティに '-windows' を含めることによる)。 + NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so. {StrBegin="NETSDK1136: "} NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll. Please update to a newer .NET SDK in order to reference this assembly. - NETSDK1148: 参照アセンブリは、より新しいバージョンの Microsoft.Windows.SDK.NET.dll を使用してコンパイルされています。このアセンブリを参照するには、より新しい .NET SDK に更新してください。 + NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll. Please update to a newer .NET SDK in order to reference this assembly. {StrBegin="NETSDK1148: "} NETSDK1178: The project depends on the following workload packs that do not exist in any of the workloads available in this installation: {0} You may need to build the project on another operating system or architecture, or update the .NET SDK. - NETSDK1178: プロジェクトは、このインストールで使用可能なワークロードのいずれにも存在しない次のワークロード パックに依存しています。{0} -別のオペレーティング システムまたはアーキテクチャでプロジェクトをビルドするか、.NET SDK を更新することが必要な場合があります。 + NETSDK1178: The project depends on the following workload packs that do not exist in any of the workloads available in this installation: {0} +You may need to build the project on another operating system or architecture, or update the .NET SDK. {StrBegin="NETSDK1178: "} NETSDK1147: To build this project, the following workloads must be installed: {0} To install these workloads, run the following command: dotnet workload restore - NETSDK1147: このプロジェクトをビルドするには、次のワークロードをインストールする必要があります: {0} -これらのワークロードをインストールするには、次のコマンドを実行します: dotnet workload restore + NETSDK1147: To build this project, the following workloads must be installed: {0} +To install these workloads, run the following command: dotnet workload restore {StrBegin="NETSDK1147: "} LOCALIZATION: Do not localize "dotnet workload restore" diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 7b32519195f8..503379511cb4 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 51f08de66c07..941b9d5a4686 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index c00ee9d248f1..998af0866441 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 2beb0f7c6842..d17eaf816f4f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index ea81aa452d6e..412f82a31c93 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index cdd1499d4db0..6ed3c105fa3f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index ff5b9ff9f953..171ed73a6fea 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -796,9 +796,9 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1199: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - {StrBegin="NETSDK1199: "} + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + {StrBegin="NETSDK1201: "} NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. From 698325fd5f58d8e54af1e7cd16ed89afa5b493de Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Apr 2023 17:04:17 -0700 Subject: [PATCH 36/60] Revert "remove selfcontained added to test lib because it should get inferred" This reverts commit e16385b69ad96443b5efc207ac5fe47e38a9dd11. --- src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj b/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj index cc105f746d4f..41c2eaa9f450 100644 --- a/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj +++ b/src/Assets/TestProjects/TrimmedAppWithReferences/App/App.csproj @@ -5,6 +5,7 @@ $(CurrentTargetFramework) true false + True From 5d166a57a0aceaef6ab78dd1b9f546f4d3806dff Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 26 Apr 2023 09:22:39 -0700 Subject: [PATCH 37/60] remove binlogs from tests --- .../EndToEndTests.cs | 4 +- ...GivenThatWeWantToBuildASelfContainedApp.cs | 2 +- .../GivenThatWeWantToUseAnalyzers.cs | 2 +- ...lazorWasmStaticWebAssetsIntegrationTest.cs | 14 +-- .../WasmBuildIncrementalismTest.cs | 2 +- .../WasmBuildIntegrationTest.cs | 18 ++-- .../WasmBuildLazyLoadTest.cs | 4 +- .../WasmCompressionTests.cs | 4 +- .../WasmJsModulesIntegrationTests.cs | 12 +-- .../WasmPublishIntegrationTest.cs | 20 ++-- .../WasmPwaManifestTests.cs | 2 +- .../JsModulesIntegrationTest.cs | 14 +-- .../ScopedCssIntegrationTests.cs | 12 +-- .../StaticWebAssetsIntegrationTest.cs | 92 +++++++++---------- 14 files changed, 101 insertions(+), 101 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs index 5ae05becec73..180347fdc094 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs @@ -218,7 +218,7 @@ public async Task EndToEnd_NoAPI_Web(bool addPackageReference) "publish", "/p:publishprofile=DefaultContainer", "/p:runtimeidentifier=linux-x64", - "/bl", + , $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageDefault}", $"/p:ContainerRegistry={DockerRegistryManager.LocalRegistry}", $"/p:ContainerImageName={imageName}", @@ -347,7 +347,7 @@ public void EndToEnd_NoAPI_Console() "publish", "/t:PublishContainer", "/p:runtimeidentifier=linux-x64", - "/bl", + , $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageDefault}", $"/p:ContainerRegistry={DockerRegistryManager.LocalRegistry}", $"/p:ContainerImageName={imageName}", diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index eb9e7fcb3b7b..bc803a163a1e 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -434,7 +434,7 @@ public void It_does_or_doesnt_warn_based_on_SelfContained_and_TargetFramework_br var buildCommand = new DotnetBuildCommand(Log); var commandResult = buildCommand .WithWorkingDirectory(testAsset.Path) - .Execute("/bl"); + .Execute(); if (targetFramework == "net7.0" && !defineSelfContained) { diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs index dedcc125a294..14750953065b 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs @@ -109,7 +109,7 @@ public void It_resolves_analyzers_correctly(string language, string testAssetNam command .WithWorkingDirectory(asset.Path) - .Execute("/bl") + .Execute() .Should().Pass(); var analyzers = command.GetValues(); diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs index e93cdc3d254e..3c6ef6b4f24f 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs @@ -31,7 +31,7 @@ public void StaticWebAssets_BuildMinimal_Works() var build = new BuildCommand(ProjectDirectory); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var outputPath = build.GetOutputDirectory(DefaultTfm).ToString(); @@ -65,7 +65,7 @@ public void StaticWebAssets_PublishMinimal_Works() var publish = new PublishCommand(ProjectDirectory); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var publishPath = publish.GetOutputDirectory(DefaultTfm).ToString(); @@ -92,7 +92,7 @@ public void StaticWebAssets_Build_Hosted_Works() var build = new BuildCommand(ProjectDirectory, "blazorhosted"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var outputPath = build.GetOutputDirectory(DefaultTfm).ToString(); @@ -127,7 +127,7 @@ public void StaticWebAssets_Publish_Hosted_Works() var publish = new PublishCommand(ProjectDirectory, "blazorhosted"); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var publishPath = publish.GetOutputDirectory(DefaultTfm).ToString(); @@ -158,7 +158,7 @@ public void StaticWebAssets_Publish_DoesNotIncludeXmlDocumentationFiles_AsAssets var publish = new PublishCommand(ProjectDirectory, "blazorhosted"); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/p:GenerateDocumentationFile=true", "/bl"); + var publishResult = publish.Execute("/p:GenerateDocumentationFile=true"); publishResult.Should().Pass(); var publishPath = publish.GetOutputDirectory(DefaultTfm).ToString(); @@ -203,7 +203,7 @@ public void StaticWebAssets_HostedApp_ReferencingNetStandardLibrary_Works() var build = new BuildCommand(ProjectDirectory, "blazorhosted"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var outputPath = build.GetOutputDirectory(DefaultTfm).ToString(); @@ -257,7 +257,7 @@ public void StaticWebAssets_BackCompatibilityPublish_Hosted_Works() var publish = new PublishCommand(ProjectDirectory, "blazorhosted"); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var publishPath = publish.GetOutputDirectory(DefaultTfm).ToString(); diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIncrementalismTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIncrementalismTest.cs index 77b9a08fa271..e6b924270a02 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIncrementalismTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIncrementalismTest.cs @@ -74,7 +74,7 @@ public void Build_GzipCompression_IsIncremental() var build = new BuildCommand(projectDirectory, "blazorwasm"); build.WithWorkingDirectory(projectDirectory.TestRoot); - build.Execute("/bl") + build.Execute() .Should() .Pass(); diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs index b68806524e5d..60cf96cd0cd6 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs @@ -105,12 +105,12 @@ public void Build_Works_WithLibraryUsingHintPath() var buildLibraryCommand = new BuildCommand(testInstance, "razorclasslibrary"); buildLibraryCommand.WithWorkingDirectory(testInstance.TestRoot); - buildLibraryCommand.Execute("/bl") + buildLibraryCommand.Execute() .Should().Pass(); var buildCommand = new BuildCommand(testInstance, "blazorwasm"); buildCommand.WithWorkingDirectory(testInstance.TestRoot); - buildCommand.Execute("/bl") + buildCommand.Execute() .Should().Pass(); var buildOutputDirectory = buildCommand.GetOutputDirectory(DefaultTfm).ToString(); @@ -171,7 +171,7 @@ public void Build_ProducesBootJsonDataWithExpectedContent() var buildCommand = new BuildCommand(testInstance, "blazorwasm"); buildCommand.WithWorkingDirectory(testInstance.TestRoot); - buildCommand.Execute("/bl") + buildCommand.Execute() .Should().Pass(); var buildOutputDirectory = buildCommand.GetOutputDirectory(DefaultTfm).ToString(); @@ -210,7 +210,7 @@ public void Build_InRelease_ProducesBootJsonDataWithExpectedContent() var buildCommand = new BuildCommand(testInstance, "blazorwasm"); buildCommand.WithWorkingDirectory(testInstance.TestRoot); - buildCommand.Execute("/p:Configuration=Release", "/bl") + buildCommand.Execute("/p:Configuration=Release") .Should().Pass(); var buildOutputDirectory = buildCommand.GetOutputDirectory(DefaultTfm, "Release").ToString(); @@ -321,7 +321,7 @@ public void Publish_WithInvariantGlobalizationEnabled_DoesNotCopyGlobalizationDa var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl") + publishCommand.Execute() .Should().Pass(); var publishOutputDirectory = publishCommand.GetOutputDirectory(DefaultTfm).ToString(); @@ -401,7 +401,7 @@ public void Publish_WithBlazorWebAssemblyLoadCustomGlobalizationData_SetsICUData var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl") + publishCommand.Execute() .Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(DefaultTfm).ToString(); @@ -482,7 +482,7 @@ public void Publish_WithBlazorWebAssemblyLoadAllGlobalizationData_SetsICUDataMod var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl") + publishCommand.Execute() .Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(DefaultTfm).ToString(); @@ -513,7 +513,7 @@ public void Build_Hosted_Works() var buildCommand = new BuildCommand(testInstance, "blazorhosted"); buildCommand.WithWorkingDirectory(testInstance.TestRoot); - buildCommand.Execute("/bl").Should().Pass(); + buildCommand.Execute().Should().Pass(); var buildOutputDirectory = buildCommand.GetOutputDirectory(DefaultTfm).ToString(); @@ -546,7 +546,7 @@ public void Build_SatelliteAssembliesAreCopiedToBuildOutput() var buildCommand = new BuildCommand(ProjectDirectory, "blazorwasm"); buildCommand.WithWorkingDirectory(ProjectDirectory.TestRoot); - buildCommand.Execute("/bl").Should().Pass(); + buildCommand.Execute().Should().Pass(); var outputPath = buildCommand.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = buildCommand.GetIntermediateDirectory(DefaultTfm).ToString(); diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildLazyLoadTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildLazyLoadTest.cs index be39f03cb95e..4077dfc7a7f3 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildLazyLoadTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildLazyLoadTest.cs @@ -42,7 +42,7 @@ public void Build_LazyLoadExplicitAssembly_Debug_Works() // Act var buildCommand = new BuildCommand(testInstance, "blazorwasm"); buildCommand.WithWorkingDirectory(testInstance.TestRoot); - buildCommand.Execute("/bl") + buildCommand.Execute() .Should().Pass(); var outputDirectory = buildCommand.GetOutputDirectory(DefaultTfm); @@ -139,7 +139,7 @@ public void Publish_LazyLoadExplicitAssembly_Debug_Works() // Act var publishCommand = new PublishCommand(testInstance, "blazorwasm"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl") + publishCommand.Execute() .Should().Pass(); var outputDirectory = publishCommand.GetOutputDirectory(DefaultTfm); diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmCompressionTests.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmCompressionTests.cs index 0c3534b489d0..7f40732dfa47 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmCompressionTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmCompressionTests.cs @@ -101,7 +101,7 @@ public void Publish_WithLinkerAndCompression_IsIncremental() var publishCommand = new PublishCommand(Log, Path.Combine(testInstance.TestRoot, "blazorhosted")); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl").Should().Pass(); + publishCommand.Execute().Should().Pass(); var buildOutputDirectory = publishCommand.GetOutputDirectory(DefaultTfm); @@ -165,7 +165,7 @@ public void Publish_CompressesAllFrameworkFiles() var publishCommand = new PublishCommand(testInstance, "blazorwasm"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl").Should().Pass(); + publishCommand.Execute().Should().Pass(); var extensions = new[] { ".dll", ".js", ".pdb", ".wasm", ".map", ".json", ".dat" }; diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs index eeb24a9335cc..18aa7604568b 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs @@ -32,7 +32,7 @@ public void Build_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJsonM var build = new BuildCommand(ProjectDirectory); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var outputPath = build.GetOutputDirectory(DefaultTfm).ToString(); @@ -64,7 +64,7 @@ public void JSModules_ManifestIncludesModuleTargetPaths() var build = new BuildCommand(ProjectDirectory, "blazorhosted"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var outputPath = build.GetOutputDirectory(DefaultTfm).ToString(); @@ -99,7 +99,7 @@ public void Publish_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJso var publish = new PublishCommand(ProjectDirectory); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); @@ -151,7 +151,7 @@ public void JsModules_CanHaveDifferentBuildAndPublishModules() var publish = new PublishCommand(ProjectDirectory); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); @@ -225,7 +225,7 @@ public void JsModules_CanCustomizeBlazorInitialization() var publish = new PublishCommand(ProjectDirectory); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); @@ -292,7 +292,7 @@ public void JsModules_Hosted_CanCustomizeBlazorInitialization() var publish = new PublishCommand(ProjectDirectory, "blazorhosted"); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPublishIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPublishIntegrationTest.cs index 794337e103bd..7e666ea5ccbb 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPublishIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPublishIntegrationTest.cs @@ -127,12 +127,12 @@ public void Publish_Works_WithLibraryUsingHintPath() var buildLibraryCommand = new BuildCommand(testInstance, "razorclasslibrary"); buildLibraryCommand.WithWorkingDirectory(testInstance.TestRoot); - buildLibraryCommand.Execute("/bl") + buildLibraryCommand.Execute() .Should().Pass(); var publishCommand = new PublishCommand(testInstance, "blazorwasm"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl").Should().Pass(); + publishCommand.Execute().Should().Pass(); var publishOutputDirectory = publishCommand.GetOutputDirectory(DefaultTfm).ToString(); @@ -260,7 +260,7 @@ public void Publish_WithNoBuild_Works() var publishCommand = new PublishCommand(testInstance, "blazorwasm"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/p:NoBuild=true", "/bl").Should().Pass(); + publishCommand.Execute("/p:NoBuild=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(DefaultTfm); var blazorPublishDirectory = Path.Combine(publishDirectory.ToString(), "wwwroot"); @@ -540,7 +540,7 @@ public void Publish_HostedApp_DefaultSettings_Works() var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl").Should().Pass(); + publishCommand.Execute().Should().Pass(); var publishOutputDirectory = publishCommand.GetOutputDirectory(DefaultTfm); @@ -678,7 +678,7 @@ public void Publish_HostedApp_WithSatelliteAssemblies() var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl").Should().Pass(); + publishCommand.Execute().Should().Pass(); var publishOutputDirectory = publishCommand.GetOutputDirectory(DefaultTfm); @@ -809,7 +809,7 @@ public void Publish_HostedApp_WithNoBuild_Works() var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/p:NoBuild=true", "/bl").Should().Pass(); + publishCommand.Execute("/p:NoBuild=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(DefaultTfm); // Make sure the main project exists @@ -1084,7 +1084,7 @@ public void Publish_HostedApp_WithRidSpecifiedInCLI_Works() var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/p:RuntimeIdentifier=linux-x64", "/bl").Should().Pass(); + publishCommand.Execute("/p:RuntimeIdentifier=linux-x64").Should().Pass(); AssertRIDPublishOuput(publishCommand, testInstance, hosted: true); } @@ -1112,7 +1112,7 @@ public void Publish_HostedApp_WithRidSpecifiedAsArgument_NoSelfContained_Works() var publishCommand = new DotnetPublishCommand(Log, Path.Combine(testInstance.TestRoot, "blazorhosted")); publishCommand.WithRuntime("linux-x64"); publishCommand.WithWorkingDirectory(Path.Combine(testInstance.TestRoot, "blazorhosted")); - var result = publishCommand.Execute("--no-self-contained", "/bl"); + var result = publishCommand.Execute("--no-self-contained"); result.Should().Pass(); AssertRIDPublishOuput(publishCommand, testInstance, hosted: true, selfContained: false); } @@ -1127,7 +1127,7 @@ public void Publish_HostedApp_WithRidSpecifiedAsArgument_Works() var publishCommand = new DotnetPublishCommand(Log, Path.Combine(testInstance.TestRoot, "blazorhosted")); publishCommand.WithWorkingDirectory(Path.Combine(testInstance.TestRoot, "blazorhosted")); publishCommand.WithRuntime("linux-x64"); - var result = publishCommand.Execute("--self-contained", "/bl"); + var result = publishCommand.Execute("--self-contained"); result.Should().Pass(); AssertRIDPublishOuput(publishCommand, testInstance, hosted: true); @@ -1142,7 +1142,7 @@ public void Publish_HostedApp_WithRid_Works() var publishCommand = new PublishCommand(testInstance, "blazorhosted"); publishCommand.WithWorkingDirectory(testInstance.TestRoot); - publishCommand.Execute("/bl").Should().Pass(); + publishCommand.Execute().Should().Pass(); AssertRIDPublishOuput(publishCommand, testInstance, hosted: true); } diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPwaManifestTests.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPwaManifestTests.cs index 9e9f27502617..0c6d610e8d80 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPwaManifestTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPwaManifestTests.cs @@ -33,7 +33,7 @@ public void Build_ServiceWorkerAssetsManifest_Works() var buildCommand = new BuildCommand(testInstance, "blazorwasm"); buildCommand.WithWorkingDirectory(testInstance.TestRoot); - buildCommand.Execute("/p:ServiceWorkerAssetsManifest=service-worker-assets.js", "/bl") + buildCommand.Execute("/p:ServiceWorkerAssetsManifest=service-worker-assets.js") .Should().Pass(); var buildOutputDirectory = buildCommand.GetOutputDirectory(DefaultTfm).ToString(); diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs index 415617b497da..680d574a5206 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs @@ -51,7 +51,7 @@ public void Build_GeneratesManifestWhenItFindsALibrary() var build = new BuildCommand(projectDirectory); build.WithWorkingDirectory(projectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = Path.Combine(build.GetBaseIntermediateDirectory().ToString(), "Debug", DefaultTfm); @@ -75,7 +75,7 @@ public void Build_DiscoversJsModulesBasedOnPatterns() var build = new BuildCommand(ProjectDirectory); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -105,7 +105,7 @@ public void Publish_PublishesBundleToTheRightLocation() var publish = new PublishCommand(ProjectDirectory); publish.WithWorkingDirectory(ProjectDirectory.TestRoot); - var publishResult = publish.Execute("/bl"); + var publishResult = publish.Execute(); publishResult.Should().Pass(); var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); @@ -145,7 +145,7 @@ public void Does_Nothing_WhenThereAreNoJsModulesFiles() var build = new BuildCommand(projectDirectory); build.WithWorkingDirectory(projectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = Path.Combine(build.GetBaseIntermediateDirectory().ToString(), "Debug", DefaultTfm); @@ -207,7 +207,7 @@ public void BuildProjectWithReferences_IncorporatesInitializersFromClassLibrarie var build = new BuildCommand(Log, Path.Combine(ProjectDirectory.TestRoot, "AppWithPackageAndP2PReference")); build.WithWorkingDirectory(ProjectDirectory.Path); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -245,7 +245,7 @@ public void PublishProjectWithReferences_IncorporatesInitializersFromClassLibrar var publish = new PublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); publish.WithWorkingDirectory(ProjectDirectory.Path); - publish.Execute("/bl").Should().Pass(); + publish.Execute().Should().Pass(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -297,7 +297,7 @@ public void PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitial }); var publish = new PublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); publish.WithWorkingDirectory(ProjectDirectory.Path); - publish.Execute("/bl").Should().Pass(); + publish.Execute().Should().Pass(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs index 7890cff0ec95..fe7b2fe056c6 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs @@ -250,7 +250,7 @@ public void Publish_PublishesBundleToTheRightLocation() var publish = new PublishCommand(projectDirectory); publish.WithWorkingDirectory(projectDirectory.TestRoot); - publish.Execute("/bl").Should().Pass(); + publish.Execute().Should().Pass(); var publishOutputPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -267,7 +267,7 @@ public void Publish_NoBuild_PublishesBundleToTheRightLocation() var build = new BuildCommand(projectDirectory); build.WithWorkingDirectory(projectDirectory.Path); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var publish = new PublishCommand(projectDirectory); @@ -305,7 +305,7 @@ public void Publish_Publishes_IndividualScopedCssFiles_WhenNoBundlingIsEnabled() var publish = new PublishCommand(projectDirectory); publish.WithWorkingDirectory(projectDirectory.TestRoot); - publish.Execute("/p:DisableScopedCssBundling=true", "/bl").Should().Pass(); + publish.Execute("/p:DisableScopedCssBundling=true").Should().Pass(); var publishOutputPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -416,7 +416,7 @@ public void BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles() var build = new BuildCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -460,7 +460,7 @@ public void ScopedCss_IsBackwardsCompatible_WithPreviousVersions() var build = new BuildCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -503,7 +503,7 @@ public void ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions() var build = new PublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs index e3349222f3f4..985a8df2c9fb 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsIntegrationTest.cs @@ -33,7 +33,7 @@ public void Build_GeneratesJsonManifestAndCopiesItToOutputFolder() var build = new BuildCommand(ProjectDirectory); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -176,7 +176,7 @@ public void BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputF var build = new BuildCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -228,7 +228,7 @@ public void BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries( var build = new BuildCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -286,7 +286,7 @@ public void PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibrarie var publish = new PublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); publish.WithWorkingDirectory(ProjectDirectory.Path); - publish.Execute("/bl").Should().Pass(); + publish.Execute().Should().Pass(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var publishPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -619,7 +619,7 @@ public void PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPu var publish = new PublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); publish.WithWorkingDirectory(ProjectDirectory.Path); - publish.Execute("/bl").Should().Pass(); + publish.Execute().Should().Pass(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var publishPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -692,7 +692,7 @@ public void PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAnd var build = new BuildCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); build.WithWorkingDirectory(ProjectDirectory.TestRoot); - build.Execute("/bl").Should().Pass(); + build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -761,7 +761,7 @@ public void PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_ var publish = new PublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); publish.WithWorkingDirectory(ProjectDirectory.Path); - publish.Execute("/p:AppendTargetFrameworkToOutputPath=false", "/bl").Should().Pass(); + publish.Execute("/p:AppendTargetFrameworkToOutputPath=false").Should().Pass(); // Hard code output paths here to account for AppendTargetFrameworkToOutputPath=false var intermediateOutputPath = Path.Combine(ProjectDirectory.Path, "AppWithPackageAndP2PReference", "obj", "Debug"); @@ -914,7 +914,7 @@ public void Pack_IncludesStaticWebAssets() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -944,7 +944,7 @@ public void Pack_NoAssets_DoesNothing() var pack = new MSBuildCommand(projectDirectory, "Pack"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -979,7 +979,7 @@ public void Pack_NoAssets_Multitargeting_DoesNothing() var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -1007,13 +1007,13 @@ public void Pack_Incremental_IncludesStaticWebAssets() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); var pack2 = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack2.WithWorkingDirectory(projectDirectory.Path); - var result2 = pack2.Execute("/bl"); + var result2 = pack2.Execute(); result2.Should().Pass(); @@ -1045,7 +1045,7 @@ public void Pack_StaticWebAssets_WithoutFileExtension_AreCorrectlyPacked() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -1078,7 +1078,7 @@ public void Build_StaticWebAssets_GeneratePackageOnBuild_PacksStaticWebAssets() var buildCommand = new BuildCommand(projectDirectory, "PackageLibraryDirectDependency"); buildCommand.WithWorkingDirectory(projectDirectory.Path); - var result = buildCommand.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = buildCommand.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -1110,7 +1110,7 @@ public void Build_StaticWebAssets_GeneratePackageOnBuild_DoesNotIncludeAssetsAsC var buildCommand = new BuildCommand(projectDirectory, "PackageLibraryDirectDependency"); buildCommand.WithWorkingDirectory(projectDirectory.Path); - var result = buildCommand.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = buildCommand.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -1151,7 +1151,7 @@ public void Pack_MultipleTargetFrameworks_Works() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -1192,11 +1192,11 @@ public void Pack_MultipleTargetFrameworks_NoBuild_IncludesStaticWebAssets() var build = new BuildCommand(projectDirectory, "PackageLibraryDirectDependency"); build.WithWorkingDirectory(projectDirectory.Path); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); result.Should().Pass(); @@ -1237,11 +1237,11 @@ public void Pack_MultipleTargetFrameworks_NoBuild_DoesNotIncludeAssetsAsContent( var build = new BuildCommand(Log, projectDirectory.Path, "PackageLibraryDirectDependency"); build.WithWorkingDirectory(projectDirectory.Path); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); result.Should().Pass(); @@ -1280,7 +1280,7 @@ public void Pack_MultipleTargetFrameworks_GeneratePackageOnBuild_IncludesStaticW var build = new BuildCommand(projectDirectory, "PackageLibraryDirectDependency"); build.WithWorkingDirectory(projectDirectory.Path); - var result = build.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = build.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -1321,7 +1321,7 @@ public void Pack_MultipleTargetFrameworks_GeneratePackageOnBuild_DoesNotIncludeA var build = new BuildCommand(projectDirectory, "PackageLibraryDirectDependency"); build.WithWorkingDirectory(projectDirectory.Path); - var result = build.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = build.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -1382,7 +1382,7 @@ This component is defined in the razorclasslibrarypack library. var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -1452,7 +1452,7 @@ This component is defined in the razorclasslibrarypack library. var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -1521,13 +1521,13 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); result.Should().Pass(); @@ -1597,13 +1597,13 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); result.Should().Pass(); @@ -1672,7 +1672,7 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var result = build.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = build.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -1742,7 +1742,7 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var result = build.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = build.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -1809,7 +1809,7 @@ This component is defined in the razorclasslibrarypack library. var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -1877,7 +1877,7 @@ This component is defined in the razorclasslibrarypack library. var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -1944,13 +1944,13 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); result.Should().Pass(); @@ -2018,13 +2018,13 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var buildResult = build.Execute("/bl"); + var buildResult = build.Execute(); buildResult.Should().Pass(); var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); result.Should().Pass(); @@ -2091,7 +2091,7 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var result = build.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = build.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -2159,7 +2159,7 @@ This component is defined in the razorclasslibrarypack library. var build = new BuildCommand(Log, projectDirectory.Path); build.WithWorkingDirectory(projectDirectory.Path); - var result = build.Execute("/p:GeneratePackageOnBuild=true", "/bl"); + var result = build.Execute("/p:GeneratePackageOnBuild=true"); result.Should().Pass(); @@ -2233,7 +2233,7 @@ This component is defined in the razorclasslibrarypack library. var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -2312,7 +2312,7 @@ This component is defined in the razorclasslibrarypack library. var pack2 = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack2.WithWorkingDirectory(projectDirectory.Path); - var result2 = pack2.Execute("/bl"); + var result2 = pack2.Execute(); result2.Should().Pass(); @@ -2387,7 +2387,7 @@ This component is defined in the razorclasslibrarypack library. var pack = new MSBuildCommand(Log, "Pack", projectDirectory.Path); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -2430,7 +2430,7 @@ public void Pack_MultipleTargetFrameworks_DoesNotIncludeAssetsAsContent() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.Path); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -2457,7 +2457,7 @@ public void Pack_DoesNotInclude_TransitiveBundleOrScopedCssAsStaticWebAsset() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.TestRoot); - var result = pack.Execute("/bl"); + var result = pack.Execute(); result.Should().Pass(); @@ -2518,7 +2518,7 @@ public void Pack_NoBuild_IncludesStaticWebAssets() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.TestRoot); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); var outputPath = pack.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -2549,7 +2549,7 @@ public void Pack_NoBuild_DoesNotIncludeFilesAsContent() var pack = new MSBuildCommand(projectDirectory, "Pack", "PackageLibraryDirectDependency"); pack.WithWorkingDirectory(projectDirectory.TestRoot); - var result = pack.Execute("/p:NoBuild=true", "/bl"); + var result = pack.Execute("/p:NoBuild=true"); var outputPath = pack.GetOutputDirectory(DefaultTfm, "Debug").ToString(); @@ -2602,7 +2602,7 @@ public void Pack_Incremental_DoesNotRegenerateCacheAndPropsFiles() var pack = new MSBuildCommand(projectDirectory, "Pack"); pack.WithWorkingDirectory(projectDirectory.TestRoot); - var result = pack.Execute("/bl"); + var result = pack.Execute(); var intermediateOutputPath = pack.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = pack.GetOutputDirectory(DefaultTfm, "Debug").ToString(); From 915089deabed2f34b02c51ff3966ac27eadfba3f Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 26 Apr 2023 09:26:29 -0700 Subject: [PATCH 38/60] use the msbuild version comparison function instead of lt and rt in runtimeidentifierinference --- .../Microsoft.NET.RuntimeIdentifierInference.targets | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 2cfddd7ad8cf..4290659e0c9c 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 @@ -64,8 +64,7 @@ Copyright (c) .NET Foundation. All rights reserved. true + $([MSBuild]::VersionLessThan($(_TargetFrameworkVersionWithoutV), '8.0'))">true false <_RuntimeIdentifierUsesAppHost Condition="$(RuntimeIdentifier.StartsWith('ios')) or $(RuntimeIdentifier.StartsWith('tvos')) or $(RuntimeIdentifier.StartsWith('maccatalyst')) or $(RuntimeIdentifier.StartsWith('android')) or $(RuntimeIdentifier.StartsWith('browser'))">false <_RuntimeIdentifierUsesAppHost Condition="'$(_RuntimeIdentifierUsesAppHost)' == ''">true @@ -245,7 +244,7 @@ Copyright (c) .NET Foundation. All rights reserved. - From 000c4a6518514d06787f0f67ee0ea2339ad21c16 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 26 Apr 2023 09:39:32 -0700 Subject: [PATCH 39/60] fix container test which had different bl syntax --- .../EndToEndTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs index 180347fdc094..b1e23fad77e2 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs @@ -218,7 +218,6 @@ public async Task EndToEnd_NoAPI_Web(bool addPackageReference) "publish", "/p:publishprofile=DefaultContainer", "/p:runtimeidentifier=linux-x64", - , $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageDefault}", $"/p:ContainerRegistry={DockerRegistryManager.LocalRegistry}", $"/p:ContainerImageName={imageName}", @@ -347,7 +346,6 @@ public void EndToEnd_NoAPI_Console() "publish", "/t:PublishContainer", "/p:runtimeidentifier=linux-x64", - , $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageDefault}", $"/p:ContainerRegistry={DockerRegistryManager.LocalRegistry}", $"/p:ContainerImageName={imageName}", From 5d1515211500c8f4b146773973154584ca01df9c Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 26 Apr 2023 10:17:23 -0700 Subject: [PATCH 40/60] add the empty tfm check back as the msbuild function will fail if given empty string --- .../targets/Microsoft.NET.RuntimeIdentifierInference.targets | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 4290659e0c9c..df9b2ddb08e2 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 @@ -64,6 +64,7 @@ Copyright (c) .NET Foundation. All rights reserved. true + '$(_TargetFrameworkVersionWithoutV)' != '' and $([MSBuild]::VersionLessThan($(_TargetFrameworkVersionWithoutV), '8.0'))">true false <_RuntimeIdentifierUsesAppHost Condition="$(RuntimeIdentifier.StartsWith('ios')) or $(RuntimeIdentifier.StartsWith('tvos')) or $(RuntimeIdentifier.StartsWith('maccatalyst')) or $(RuntimeIdentifier.StartsWith('android')) or $(RuntimeIdentifier.StartsWith('browser'))">false <_RuntimeIdentifierUsesAppHost Condition="'$(_RuntimeIdentifierUsesAppHost)' == ''">true @@ -244,7 +245,7 @@ Copyright (c) .NET Foundation. All rights reserved. - From 72b31a43e8d1426380cac002fbff1178ff95d00a Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Wed, 26 Apr 2023 16:37:33 -0500 Subject: [PATCH 41/60] Update container tests to push to correct net8 base images With RID no longer forcing SelfContained, the base image for many tests changed. In addition, for 8 previews we track very aggressively and we're currently ahead of the image tags that are available - SDK-facing tests therefore must relax a bit and pin runtimes to a slightly earlier version. --- .../CreateNewImageTests.cs | 6 +-- .../DockerRegistryManager.cs | 15 ++++--- .../EndToEndTests.cs | 45 +++++++++++-------- .../RegistryTests.cs | 2 +- 4 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs index 3aee8da85351..0b1e9bf42da4 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs @@ -138,13 +138,13 @@ public void Tasks_EndToEnd_With_EnvironmentVariable_Validation() File.WriteAllText(Path.Combine(newProjectDir.FullName, "Program.cs"), $"Console.Write(Environment.GetEnvironmentVariable(\"GoodEnvVar\"));"); - new DotnetCommand(_testOutput, "build", "--configuration", "release", "/p:runtimeidentifier=linux-x64") + new DotnetCommand(_testOutput, "build", "--configuration", "release", "/p:runtimeidentifier=linux-x64", $"/p:RuntimeFrameworkVersion=8.0.0-preview.3.23174.8") .WithWorkingDirectory(newProjectDir.FullName) .Execute() .Should().Pass(); ParseContainerProperties pcp = new ParseContainerProperties(); - pcp.FullyQualifiedBaseImageName = "mcr.microsoft.com/dotnet/runtime:6.0"; + pcp.FullyQualifiedBaseImageName = $"mcr.microsoft.com/{DockerRegistryManager.RuntimeBaseImage}:{DockerRegistryManager.Net8PreviewImageTag}"; pcp.ContainerRegistry = ""; pcp.ContainerImageName = "dotnet/envvarvalidation"; pcp.ContainerImageTag = "latest"; @@ -157,7 +157,7 @@ public void Tasks_EndToEnd_With_EnvironmentVariable_Validation() Assert.True(pcp.Execute()); Assert.Equal("mcr.microsoft.com", pcp.ParsedContainerRegistry); Assert.Equal("dotnet/runtime", pcp.ParsedContainerImage); - Assert.Equal("6.0", pcp.ParsedContainerTag); + Assert.Equal(DockerRegistryManager.Net8PreviewImageTag, pcp.ParsedContainerTag); Assert.Single(pcp.NewContainerEnvironmentVariables); Assert.Equal("Foo", pcp.NewContainerEnvironmentVariables[0].GetMetadata("Value")); diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/DockerRegistryManager.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/DockerRegistryManager.cs index 96d13f8eb4ce..09d6b10470a3 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/DockerRegistryManager.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/DockerRegistryManager.cs @@ -10,12 +10,15 @@ namespace Microsoft.NET.Build.Containers.IntegrationTests; public class DockerRegistryManager { - public const string BaseImage = "dotnet/runtime"; + public const string RuntimeBaseImage = "dotnet/runtime"; + public const string AspNetBaseImage = "dotnet/aspnet"; public const string BaseImageSource = "mcr.microsoft.com/"; public const string Net6ImageTag = "6.0"; public const string Net7ImageTag = "7.0"; + public const string Net8PreviewImageTag = "8.0-preview"; public const string LocalRegistry = "localhost:5010"; - public const string FullyQualifiedBaseImageDefault = $"{BaseImageSource}{BaseImage}:{Net6ImageTag}"; + public const string FullyQualifiedBaseImageDefault = $"{BaseImageSource}{RuntimeBaseImage}:{Net8PreviewImageTag}"; + public const string FullyQualifiedBaseImageAspNet = $"{BaseImageSource}{AspNetBaseImage}:{Net8PreviewImageTag}"; private static string? s_registryContainerId; public static void StartAndPopulateDockerRegistry(ITestOutputHelper testOutput) @@ -29,17 +32,17 @@ public static void StartAndPopulateDockerRegistry(ITestOutputHelper testOutput) using var reader = new StringReader(processResult.StdOut!); s_registryContainerId = reader.ReadLine(); - foreach (var tag in new[] { Net6ImageTag, Net7ImageTag }) + foreach (var tag in new[] { Net6ImageTag, Net7ImageTag, Net8PreviewImageTag }) { - new RunExeCommand(testOutput, "docker", "pull", $"{BaseImageSource}{BaseImage}:{tag}") + new RunExeCommand(testOutput, "docker", "pull", $"{BaseImageSource}{RuntimeBaseImage}:{tag}") .Execute() .Should().Pass(); - new RunExeCommand(testOutput, "docker", "tag", $"{BaseImageSource}{BaseImage}:{tag}", $"{LocalRegistry}/{BaseImage}:{tag}") + new RunExeCommand(testOutput, "docker", "tag", $"{BaseImageSource}{RuntimeBaseImage}:{tag}", $"{LocalRegistry}/{RuntimeBaseImage}:{tag}") .Execute() .Should().Pass(); - new RunExeCommand(testOutput, "docker", "push", $"{LocalRegistry}/{BaseImage}:{tag}") + new RunExeCommand(testOutput, "docker", "push", $"{LocalRegistry}/{RuntimeBaseImage}:{tag}") .Execute() .Should().Pass(); } diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs index b1e23fad77e2..fdfb4f8dc612 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs @@ -45,8 +45,8 @@ public async Task ApiEndToEndWithRegistryPushAndPull() Registry registry = new Registry(ContainerHelpers.TryExpandRegistryToUri(DockerRegistryManager.LocalRegistry)); ImageBuilder imageBuilder = await registry.GetImageManifestAsync( - DockerRegistryManager.BaseImage, - DockerRegistryManager.Net6ImageTag, + DockerRegistryManager.RuntimeBaseImage, + DockerRegistryManager.Net8PreviewImageTag, "linux-x64", ToolsetUtils.GetRuntimeGraphFilePath(), cancellationToken: default).ConfigureAwait(false); @@ -62,7 +62,7 @@ public async Task ApiEndToEndWithRegistryPushAndPull() BuiltImage builtImage = imageBuilder.Build(); // Push the image back to the local registry - var sourceReference = new ImageReference(registry, DockerRegistryManager.BaseImage, DockerRegistryManager.Net6ImageTag); + var sourceReference = new ImageReference(registry, DockerRegistryManager.RuntimeBaseImage, DockerRegistryManager.Net8PreviewImageTag); var destinationReference = new ImageReference(registry, NewImageName(), "latest"); await registry.PushAsync(builtImage, sourceReference, destinationReference, Console.WriteLine, cancellationToken: default).ConfigureAwait(false); @@ -81,15 +81,15 @@ public async Task ApiEndToEndWithRegistryPushAndPull() [DockerDaemonAvailableFact] public async Task ApiEndToEndWithLocalLoad() { - string publishDirectory = BuildLocalApp(); + string publishDirectory = BuildLocalApp(tfm: "net7.0"); // Build the image Registry registry = new Registry(ContainerHelpers.TryExpandRegistryToUri(DockerRegistryManager.LocalRegistry)); ImageBuilder imageBuilder = await registry.GetImageManifestAsync( - DockerRegistryManager.BaseImage, - DockerRegistryManager.Net6ImageTag, + DockerRegistryManager.RuntimeBaseImage, + DockerRegistryManager.Net7ImageTag, "linux-x64", ToolsetUtils.GetRuntimeGraphFilePath(), cancellationToken: default).ConfigureAwait(false); @@ -104,7 +104,7 @@ public async Task ApiEndToEndWithLocalLoad() BuiltImage builtImage = imageBuilder.Build(); // Load the image into the local Docker daemon - var sourceReference = new ImageReference(registry, DockerRegistryManager.BaseImage, DockerRegistryManager.Net6ImageTag); + var sourceReference = new ImageReference(registry, DockerRegistryManager.RuntimeBaseImage, DockerRegistryManager.Net7ImageTag); var destinationReference = new ImageReference(registry, NewImageName(), "latest"); await new LocalDocker(Console.WriteLine).LoadAsync(builtImage, sourceReference, destinationReference, default).ConfigureAwait(false); @@ -131,9 +131,16 @@ private string BuildLocalApp([CallerMemberName] string testName = "TestName", st .Execute() .Should().Pass(); - new DotnetCommand(_testOutput, "publish", "-bl", "MinimalTestApp", "-r", rid, "-f", tfm, "-c", "Debug") - .WithWorkingDirectory(workingDirectory) - .Execute() + var publishCommand = + new DotnetCommand(_testOutput, "publish", "-bl", "MinimalTestApp", "-r", rid, "-f", tfm, "-c", "Debug") + .WithWorkingDirectory(workingDirectory); + + if (tfm == ToolsetInfo.CurrentTargetFramework) + { + publishCommand.Arguments.AddRange(new[] { "-p", $"RuntimeFrameworkVersion=8.0.0-preview.3.23174.8" }); + } + + publishCommand.Execute() .Should().Pass(); string publishDirectory = Path.Join(workingDirectory, "MinimalTestApp", "bin", "Debug", tfm, rid, "publish"); @@ -218,10 +225,11 @@ public async Task EndToEnd_NoAPI_Web(bool addPackageReference) "publish", "/p:publishprofile=DefaultContainer", "/p:runtimeidentifier=linux-x64", - $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageDefault}", + $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageAspNet}", $"/p:ContainerRegistry={DockerRegistryManager.LocalRegistry}", $"/p:ContainerImageName={imageName}", - $"/p:Version={imageTag}") + $"/p:Version={imageTag}", + $"/p:RuntimeFrameworkVersion=8.0.0-preview.3.23174.8") .WithEnvironmentVariable("NUGET_PACKAGES", privateNuGetAssets.FullName) .WithWorkingDirectory(newProjectDir.FullName) .Execute() @@ -240,7 +248,7 @@ public async Task EndToEnd_NoAPI_Web(bool addPackageReference) "--name", containerName, "--publish", - "5017:80", + "5017:8080", "--detach", $"{DockerRegistryManager.LocalRegistry}/{imageName}:{imageTag}") .Execute(); @@ -346,9 +354,10 @@ public void EndToEnd_NoAPI_Console() "publish", "/t:PublishContainer", "/p:runtimeidentifier=linux-x64", - $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageDefault}", + $"/p:ContainerBaseImage={DockerRegistryManager.FullyQualifiedBaseImageAspNet}", $"/p:ContainerRegistry={DockerRegistryManager.LocalRegistry}", $"/p:ContainerImageName={imageName}", + $"/p:RuntimeFrameworkVersion=8.0.0-preview.3.23174.8", $"/p:Version={imageTag}") .WithEnvironmentVariable("NUGET_PACKAGES", privateNuGetAssets.FullName) .WithWorkingDirectory(newProjectDir.FullName) @@ -377,7 +386,7 @@ public void EndToEnd_NoAPI_Console() [DockerSupportsArchInlineData("linux/arm/v7", "linux-arm", "/app")] [DockerSupportsArchInlineData("linux/arm64/v8", "linux-arm64", "/app")] - [DockerSupportsArchInlineData("linux/386", "linux-x86", "/app", Skip="There's no apphost for linux-x86 so we can't execute self-contained, and there's no .NET runtime base image for linux-x86 so we can't execute framework-dependent.")] + [DockerSupportsArchInlineData("linux/386", "linux-x86", "/app", Skip = "There's no apphost for linux-x86 so we can't execute self-contained, and there's no .NET runtime base image for linux-x86 so we can't execute framework-dependent.")] [DockerSupportsArchInlineData("windows/amd64", "win-x64", "C:\\app")] [DockerSupportsArchInlineData("linux/amd64", "linux-x64", "/app")] [DockerDaemonAvailableTheory] @@ -389,8 +398,8 @@ public async Task CanPackageForAllSupportedContainerRIDs(string dockerPlatform, Registry registry = new(ContainerHelpers.TryExpandRegistryToUri(DockerRegistryManager.BaseImageSource)); ImageBuilder? imageBuilder = await registry.GetImageManifestAsync( - DockerRegistryManager.BaseImage, - DockerRegistryManager.Net7ImageTag, + DockerRegistryManager.RuntimeBaseImage, + DockerRegistryManager.Net8PreviewImageTag, rid, ToolsetUtils.GetRuntimeGraphFilePath(), cancellationToken: default).ConfigureAwait(false); @@ -407,7 +416,7 @@ public async Task CanPackageForAllSupportedContainerRIDs(string dockerPlatform, BuiltImage builtImage = imageBuilder.Build(); // Load the image into the local Docker daemon - var sourceReference = new ImageReference(registry, DockerRegistryManager.BaseImage, DockerRegistryManager.Net7ImageTag); + var sourceReference = new ImageReference(registry, DockerRegistryManager.RuntimeBaseImage, DockerRegistryManager.Net7ImageTag); var destinationReference = new ImageReference(registry, NewImageName(), rid); await new LocalDocker(Console.WriteLine).LoadAsync(builtImage, sourceReference, destinationReference, default).ConfigureAwait(false); diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/RegistryTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/RegistryTests.cs index 7d421f807b7c..57ebb5f8ad81 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/RegistryTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/RegistryTests.cs @@ -18,7 +18,7 @@ public async Task GetFromRegistry() // Don't need rid graph for local registry image pulls - since we're only pushing single image manifests (not manifest lists) // as part of our setup, we could put literally anything in here. The file at the passed-in path would only get read when parsing manifests lists. ImageBuilder? downloadedImage = await registry.GetImageManifestAsync( - DockerRegistryManager.BaseImage, + DockerRegistryManager.RuntimeBaseImage, DockerRegistryManager.Net6ImageTag, "linux-x64", ridgraphfile, From 0e735e582a72c72fa6d940f9e8bd2e413b1c867b Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 26 Apr 2023 16:43:37 -0700 Subject: [PATCH 42/60] Improve clarity of warning message for breaking change Co-authored-by: Daniel Plaisted --- src/Tasks/Common/Resources/Strings.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 10654cf16de9..f284e9165307 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -905,7 +905,7 @@ You may need to build the project on another operating system or architecture, o {StrBegin="NETSDK1200: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} From 26550ed91f5eafb28e73d312737a739d7dd3b437 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 27 Apr 2023 09:53:16 -0700 Subject: [PATCH 43/60] undo blazor wasm self contained test additions because they prepared for the break on pr 30700 --- newc/Program.cs | 2 ++ newc/newc.csproj | 12 ++++++++++++ .../BlazorHosted/blazorhosted/blazorhosted.csproj | 2 +- .../BlazorHosted/blazorwasm/blazorwasm.csproj | 2 +- .../blazorhosted/blazorhosted-rid.csproj | 2 +- .../blazorwasm/blazorwasm.csproj | 2 +- ...rosoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj | 3 +-- 7 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 newc/Program.cs create mode 100644 newc/newc.csproj diff --git a/newc/Program.cs b/newc/Program.cs new file mode 100644 index 000000000000..3751555cbd32 --- /dev/null +++ b/newc/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/newc/newc.csproj b/newc/newc.csproj new file mode 100644 index 000000000000..28f592db2b5c --- /dev/null +++ b/newc/newc.csproj @@ -0,0 +1,12 @@ + + + + Exe + net8.0 + enable + true + true + enable + + + diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index c3bc93432540..e51ae38e412d 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,7 +8,7 @@ - + true diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index 35b69bb52bf7..bf746567f89d 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -37,7 +37,7 @@ <_BlazorBrotliCompressionLevel>NoCompression - + true diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index 18a9759d9117..54b7fc3fec04 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -14,7 +14,7 @@ - + true diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 9efdbc1a2091..2b1606ed9bcd 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -36,7 +36,7 @@ <_BlazorBrotliCompressionLevel>NoCompression - + true diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj index dda94baf5866..261ff0b4f046 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj @@ -14,7 +14,7 @@ false - + true @@ -43,7 +43,6 @@ - From 586ddd5ad2358046d43970d32d76309009541855 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 27 Apr 2023 10:54:33 -0700 Subject: [PATCH 44/60] Revert "undo blazor wasm self contained test additions because they prepared for the break on pr 30700" This reverts commit 26550ed91f5eafb28e73d312737a739d7dd3b437. --- newc/Program.cs | 2 -- newc/newc.csproj | 12 ------------ .../BlazorHosted/blazorhosted/blazorhosted.csproj | 2 +- .../BlazorHosted/blazorwasm/blazorwasm.csproj | 2 +- .../blazorhosted/blazorhosted-rid.csproj | 2 +- .../blazorwasm/blazorwasm.csproj | 2 +- ...rosoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj | 3 ++- 7 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 newc/Program.cs delete mode 100644 newc/newc.csproj diff --git a/newc/Program.cs b/newc/Program.cs deleted file mode 100644 index 3751555cbd32..000000000000 --- a/newc/Program.cs +++ /dev/null @@ -1,2 +0,0 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); diff --git a/newc/newc.csproj b/newc/newc.csproj deleted file mode 100644 index 28f592db2b5c..000000000000 --- a/newc/newc.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Exe - net8.0 - enable - true - true - enable - - - diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index e51ae38e412d..c3bc93432540 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,7 +8,7 @@ - + true diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index bf746567f89d..35b69bb52bf7 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -37,7 +37,7 @@ <_BlazorBrotliCompressionLevel>NoCompression - + true diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index 54b7fc3fec04..18a9759d9117 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -14,7 +14,7 @@ - + true diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 2b1606ed9bcd..9efdbc1a2091 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -36,7 +36,7 @@ <_BlazorBrotliCompressionLevel>NoCompression - + true diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj index 261ff0b4f046..dda94baf5866 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj @@ -14,7 +14,7 @@ false - + true @@ -43,6 +43,7 @@ + From c0a6f47e9a453646be60d76cb19a6253935ea843 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 27 Apr 2023 11:01:22 -0700 Subject: [PATCH 45/60] respond to most pr feedback --- .../blazorhosted/blazorhosted.csproj | 5 --- .../BlazorHosted/blazorwasm/blazorwasm.csproj | 5 --- .../blazorhosted/blazorhosted-rid.csproj | 5 --- .../blazorwasm/blazorwasm.csproj | 6 --- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 4 +- .../Common/Resources/xlf/Strings.pt-BR.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 4 +- .../Common/Resources/xlf/Strings.zh-Hans.xlf | 4 +- .../Common/Resources/xlf/Strings.zh-Hant.xlf | 4 +- ...oft.NET.RuntimeIdentifierInference.targets | 13 ++++-- ...GivenThatWeWantToBuildASelfContainedApp.cs | 7 ++- .../GlobalPropertyFlowTests.cs | 43 +++++++++---------- ...NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj | 9 +--- 21 files changed, 63 insertions(+), 82 deletions(-) diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index c3bc93432540..5099648fae48 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,11 +8,6 @@ - - - true - - diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index 35b69bb52bf7..4f8114d59e1f 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -37,9 +37,4 @@ <_BlazorBrotliCompressionLevel>NoCompression - - - true - - diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index 18a9759d9117..ec4b53947305 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -14,11 +14,6 @@ - - - true - - diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 9efdbc1a2091..49b8c0e4c310 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -36,10 +36,4 @@ <_BlazorBrotliCompressionLevel>NoCompression - - - true - - - diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 67085e621a62..27913d1e8c97 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 36342fcd97ec..7139258250ec 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 2ee0b0ce1e86..a0c8bb8b8b50 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 7876b1266c54..3141e82bc89f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 42ccaad13c04..1bef34901727 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 39843358b4a4..7243875a41ff 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 503379511cb4..5d063a0e628d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 941b9d5a4686..a9d671e56cbb 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 998af0866441..7ea52eb4747f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index d17eaf816f4f..223206d06156 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 412f82a31c93..944d6e82d8b0 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 6ed3c105fa3f..b4284d83008a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 171ed73a6fea..7c69e1a390bb 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -796,8 +796,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1028: "} - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. - NETSDK1201: For projects with TargetFramework(s) >= 8.0, specifying a RuntimeIdentifier no longer produces a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. + NETSDK1201: For projects targeting .NET 8.0 and higher, specifying a RuntimeIdentifier will no longer produce a self contained app by default. To continue building self-contained apps, set the SelfContained property to true or use the --self-contained argument. {StrBegin="NETSDK1201: "} 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 df9b2ddb08e2..c76f66362028 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 @@ -65,7 +65,8 @@ Copyright (c) .NET Foundation. All rights reserved. true + - true + true + false <_RuntimeIdentifierUsesAppHost Condition="$(RuntimeIdentifier.StartsWith('ios')) or $(RuntimeIdentifier.StartsWith('tvos')) or $(RuntimeIdentifier.StartsWith('maccatalyst')) or $(RuntimeIdentifier.StartsWith('android')) or $(RuntimeIdentifier.StartsWith('browser'))">false <_RuntimeIdentifierUsesAppHost Condition="'$(_RuntimeIdentifierUsesAppHost)' == ''">true @@ -348,5 +354,4 @@ Copyright (c) .NET Foundation. All rights reserved. - diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index bc803a163a1e..1f245fe4754c 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -428,10 +428,13 @@ public void It_does_or_doesnt_warn_based_on_SelfContained_and_TargetFramework_br var ns = project.Root.Name.Namespace; var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); - propertyGroup.Add(new XElement(ns + "SelfContained", defineSelfContained ? "true" : "")); + if (defineSelfContained) + { + propertyGroup.Add(new XElement(ns + "SelfContained", "true")); + } }); - var buildCommand = new DotnetBuildCommand(Log); + var buildCommand = new DotnetBuildCommand(Log, "/bl"); var commandResult = buildCommand .WithWorkingDirectory(testAsset.Path) .Execute(); diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index f63f9e5d51bd..78bf15acc019 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -84,9 +84,9 @@ public void TestGlobalPropertyFlowToLibrary(bool passSelfContained, bool passRun { var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + bool appIsSelfContainedOrRuntimeSpecific = passSelfContained || passRuntimeIdentifier; - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific); ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false); } @@ -101,10 +101,10 @@ public void TestGlobalPropertyFlowToExe(bool passSelfContained, bool passRuntime var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + bool appIsSelfContainedOrRuntimeSpecific = passSelfContained || passRuntimeIdentifier; - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific); } @@ -122,10 +122,10 @@ public void TestGlobalPropertyFlowToExeWithSelfContainedFalse(bool passSelfConta var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + bool appIsSelfContainedOrRuntimeSpecific = passSelfContained || passRuntimeIdentifier; - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific); } @@ -141,9 +141,9 @@ public void TestGlobalPropertyFlowToLibraryWithRuntimeIdentifier(bool passSelfCo var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: passSelfContained.ToString() + "_" + passRuntimeIdentifier); - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + bool appIsSelfContainedOrRuntimeSpecific = passSelfContained || passRuntimeIdentifier; - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific); // We added a rid to the referenced project so it should have one always. ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: true, expectedRuntimeIdentifier: passRuntimeIdentifier ? EnvironmentInfo.GetCompatibleRid() : _referencedProject.RuntimeIdentifier); @@ -167,20 +167,19 @@ public void TestGlobalPropertyFlowToMultitargetedProject(bool passSelfContained, string identifier = passSelfContained.ToString() + "_" + passRuntimeIdentifier; - var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); + // in net 7 or below this means to build self contained but not in net8 as the properties are independent. + bool appIsSelfContainedOrRuntimeSpecific = passSelfContained || passRuntimeIdentifier; - // in net 7 or below this means to build self contained but not in net8 as the properties are independent. - bool buildingSelfContained = passSelfContained || passRuntimeIdentifier; + var testAsset = Build(passSelfContained, passRuntimeIdentifier, identifier: identifier); - ValidateProperties(testAsset, _testProject, expectSelfContained: buildingSelfContained, expectRuntimeIdentifier: buildingSelfContained, - thisTargetFramework: "net6.0"); - ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, - thisTargetFramework: ToolsetInfo.CurrentTargetFramework); ; - ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false, - thisTargetFramework: "net6.0"); - ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: buildingSelfContained, - thisTargetFramework: ToolsetInfo.CurrentTargetFramework); - + ValidateProperties(testAsset, _testProject, expectSelfContained: appIsSelfContainedOrRuntimeSpecific, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific, + thisTargetFramework: "net6.0"); + ValidateProperties(testAsset, _testProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific, + thisTargetFramework: ToolsetInfo.CurrentTargetFramework); ; + ValidateProperties(testAsset, _referencedProject, expectSelfContained: false, expectRuntimeIdentifier: false, + thisTargetFramework: "net6.0"); + ValidateProperties(testAsset, _referencedProject, expectSelfContained: passSelfContained, expectRuntimeIdentifier: appIsSelfContainedOrRuntimeSpecific, + thisTargetFramework: ToolsetInfo.CurrentTargetFramework); } [RequiresMSBuildVersionTheory("17.4.0.41702", Skip = "https://github.com/dotnet/msbuild/issues/8154")] diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj index dda94baf5866..a95511329d3c 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj @@ -14,11 +14,6 @@ false - - - true - - @@ -28,7 +23,7 @@ <_Parameter1>AspNetTestTfm <_Parameter2>$(SdkTargetFramework) - @@ -47,7 +42,7 @@ - + From f3e8af4c8a8987f46013330c7ebb43c6e57a2d0c Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 27 Apr 2023 14:30:26 -0700 Subject: [PATCH 46/60] WIP: Modify validate exe reference test to account for tfm --- .../ValidateExecutableReferences.cs | 11 ++++++++ .../targets/Microsoft.NET.Sdk.targets | 10 ++++++- .../ReferenceExeTests.cs | 28 ++++++++++++++++--- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs index 45d791aea309..24e67fc86315 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs @@ -20,6 +20,8 @@ public class ValidateExecutableReferences : TaskBase public bool UseAttributeForTargetFrameworkInfoPropertyNames { get; set; } + public bool RuntimeIdentifierInfersSelfContained { get; set; } + protected override void ExecuteCore() { if (!IsExecutable) @@ -75,6 +77,15 @@ protected override void ExecuteCore() { referencedProjectIsSelfContained = true; } + + // If the project is of a TFM where RuntimeIdentifier still makes an app SelfContained by default: + // If the project is NOT RID agnostic, then a global RuntimeIdentifier will flow to it. + // If the project didn't explicitly specify a value for SelfContained, then this will + // set SelfContained to true + if (RuntimeIdentifierInfersSelfContained && runtimeIdentifierIsGlobalProperty && !referencedProjectHadSelfContainedSpecified) + { + referencedProjectIsSelfContained = true; + } } if (referencedProjectIsExecutable && shouldBeValidatedAsExecutableReference) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets index 61ce98d23742..814ccb232571 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets @@ -1165,6 +1165,14 @@ Copyright (c) .NET Foundation. All rights reserved. <_UseAttributeForTargetFrameworkInfoPropertyNames Condition="$([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), '17.0'))">true + + <_RuntimeIdentifierInfersSelfContained>false + <_RuntimeIdentifierInfersSelfContained Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and + '$(_TargetFrameworkVersionWithoutV)' != '' and + $([MSBuild]::VersionLessThan($(_TargetFrameworkVersionWithoutV), '8.0'))"> + true + + @@ -1174,7 +1182,7 @@ Copyright (c) .NET Foundation. All rights reserved. IsExecutable="$(_IsExecutable)" ReferencedProjects="@(_MSBuildProjectReferenceExistent)" UseAttributeForTargetFrameworkInfoPropertyNames="$(_UseAttributeForTargetFrameworkInfoPropertyNames)" - /> + RuntimeIdentifierInfersSelfContained="$(_RuntimeIdentifierInfersSelfContained)"/> diff --git a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs index 2c49a7e38105..ef29b8c1731d 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs @@ -23,6 +23,10 @@ public ReferenceExeTests(ITestOutputHelper log) : base(log) { } + private string ProjectTargetFrameworks = ""; + + private bool MainRuntimeIdentifier { get; set; } + private bool MainSelfContained { get; set; } private bool ReferencedSelfContained { get; set; } @@ -42,7 +46,7 @@ private void CreateProjects() MainProject = new TestProject() { Name = "MainProject", - TargetFrameworks = ToolsetInfo.CurrentTargetFramework, + TargetFrameworks = ProjectTargetFrameworks != "" ? ProjectTargetFrameworks : ToolsetInfo.CurrentTargetFramework, IsSdkProject = true, IsExe = true }; @@ -74,6 +78,11 @@ private void CreateProjects() MainProject.SourceFiles["Program.cs"] = mainProjectSrc; + if (MainRuntimeIdentifier) + { + MainProject.AdditionalProperties["RuntimeIdentifier"] = EnvironmentInfo.GetCompatibleRid(); + } + if (MainSelfContained) { MainProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(); @@ -83,7 +92,7 @@ private void CreateProjects() ReferencedProject = new TestProject() { Name = "ReferencedProject", - TargetFrameworks = ToolsetInfo.CurrentTargetFramework, + TargetFrameworks = ProjectTargetFrameworks != "" ? ProjectTargetFrameworks : ToolsetInfo.CurrentTargetFramework, IsSdkProject = true, IsExe = true, }; @@ -136,7 +145,7 @@ private void RunTest(string buildFailureCode = null, [CallerMemberName] string c if (buildFailureCode == null) { - buildOrPublishCommand.Execute() + buildOrPublishCommand.Execute("-bl:C:\\users\\noahgilson\\abpublish.binlog") .Should() .Pass(); @@ -216,16 +225,27 @@ public void ReferencedExeWithLowerTargetFrameworkCanRun() [Theory] [InlineData(true, false, "NETSDK1150")] [InlineData(false, true, "NETSDK1151")] - public void ReferencedExeFailsToBuild(bool mainSelfContained, bool referencedSelfContained, string expectedFailureCode) + public void ReferencedExeFailsToBuildOnOlderTargetFrameworks(bool mainSelfContained, bool referencedSelfContained, string expectedFailureCode) { MainSelfContained = mainSelfContained; ReferencedSelfContained = referencedSelfContained; + ProjectTargetFrameworks = "net7.0"; CreateProjects(); RunTest(expectedFailureCode); } + [Fact] + public void ReferencedExeDoesNotFailToBuildWith8PlusTargetFrameworks() + { + MainSelfContained = false; + MainRuntimeIdentifier = true; + CreateProjects(); + + RunTest(); + } + [Fact] public void ReferencedExeCanRunWhenReferencesExeWithSelfContainedMismatchForDifferentTargetFramework() { From f2c674a1f73fcb3f33b46139e9d5dba1e8545981 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 27 Apr 2023 16:10:03 -0700 Subject: [PATCH 47/60] wip fix exe reference framework error but tfm isnt available in the metadata coming from msbuild --- .../ValidateExecutableReferences.cs | 9 ++++++++- .../targets/Microsoft.NET.Sdk.targets | 12 +----------- .../Microsoft.NET.Build.Tests/ReferenceExeTests.cs | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs index 24e67fc86315..e3664ff9e9f3 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs @@ -56,6 +56,10 @@ protected override void ExecuteCore() bool referencedProjectIsSelfContained = MSBuildUtilities.ConvertStringToBool(projectAdditionalProperties["SelfContained"]); bool referencedProjectHadSelfContainedSpecified = MSBuildUtilities.ConvertStringToBool(projectAdditionalProperties["_SelfContainedWasSpecified"]); + string referencedProjectTargetFrameworkVersion = projectAdditionalProperties["TargetFrameworkVersion"]; + string referencedProjectTargetFrameworkIdentifier = projectAdditionalProperties["TargetFrameworkIdentifier"]; + Version? referencedProjectTargetFramework = referencedProjectTargetFrameworkIdentifier != "" ? new Version(referencedProjectTargetFrameworkVersion) : null; + var globalProperties = BuildEngine6.GetGlobalProperties(); bool selfContainedIsGlobalProperty = globalProperties.ContainsKey("SelfContained"); @@ -78,7 +82,10 @@ protected override void ExecuteCore() referencedProjectIsSelfContained = true; } - // If the project is of a TFM where RuntimeIdentifier still makes an app SelfContained by default: + // We need to check if referenced project will become SelfContained because of its RuntimeIdentifier. This only happens on TargetFrameworks less than net8.0. + Version sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained = new Version("net8.0"); + bool runtimeIdentifierInfersSelfContained = referencedProjectTargetFrameworkIdentifier == ".NETCoreApp" && referencedProjectTargetFramework.CompareTo(sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained) < 0; + // If the project is NOT RID agnostic, then a global RuntimeIdentifier will flow to it. // If the project didn't explicitly specify a value for SelfContained, then this will // set SelfContained to true diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets index 814ccb232571..e2870c027a85 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets @@ -1164,14 +1164,6 @@ Copyright (c) .NET Foundation. All rights reserved. <_UseAttributeForTargetFrameworkInfoPropertyNames Condition="$([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), '17.0'))">true - - - <_RuntimeIdentifierInfersSelfContained>false - <_RuntimeIdentifierInfersSelfContained Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and - '$(_TargetFrameworkVersionWithoutV)' != '' and - $([MSBuild]::VersionLessThan($(_TargetFrameworkVersionWithoutV), '8.0'))"> - true - - + UseAttributeForTargetFrameworkInfoPropertyNames="$(_UseAttributeForTargetFrameworkInfoPropertyNames)"/> + + true + From 30e5d61c23bb912f8ad0eda74ff329e652b6cbd2 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 28 Apr 2023 17:06:52 -0700 Subject: [PATCH 50/60] Add SelfContained to the TestProject Library and clean up the tests --- .../Microsoft.NET.Build.Tests/AppHostTests.cs | 2 +- .../DepsFileSkipTests.cs | 8 ++--- .../GivenFrameworkReferences.cs | 33 +++++++++---------- .../GivenThatWeWantToBuildANetCoreApp.cs | 4 +-- ...GivenThatWeWantToBuildASelfContainedApp.cs | 5 ++- .../GivenThatWeWantToCopyLocalDependencies.cs | 4 +-- ...ransitiveFrameworkReferencesAreDisabled.cs | 5 ++- .../GlobalPropertyFlowTests.cs | 2 +- .../ReferenceExeTests.cs | 4 +-- .../GivenThatWeWantToPublishAnAotApp.cs | 2 +- .../GivenThatWeWantToPublishIncrementally.cs | 5 +-- .../GivenThatWeWantToPublishReadyToRun.cs | 9 +++-- ...tToPublishTrimmedWindowsFormsAndWPFApps.cs | 16 ++++----- ...ivenThatWeWantToPublishWithoutConflicts.cs | 5 +-- .../GivenThatWeWantToRunILLink.cs | 11 ++++--- .../RuntimeIdentifiersTests.cs | 5 +-- .../PublishTests.cs | 2 +- .../ProjectConstruction/TestProject.cs | 9 +++++ .../GivenDotnetBuildBuildsCsproj.cs | 2 +- 19 files changed, 70 insertions(+), 63 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/AppHostTests.cs b/src/Tests/Microsoft.NET.Build.Tests/AppHostTests.cs index 5bfb10fc333a..c559f6e65157 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/AppHostTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/AppHostTests.cs @@ -371,8 +371,8 @@ public void If_UseAppHost_is_false_it_does_not_try_to_find_an_AppHost() // Use "any" as RID so that it will fail to find AppHost RuntimeIdentifier = "any", IsExe = true, + SelfContained = "false" }; - testProject.AdditionalProperties["SelfContained"] = "false"; testProject.AdditionalProperties["UseAppHost"] = "false"; var testAsset = _testAssetsManager.CreateTestProject(testProject); diff --git a/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs b/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs index c0c8c124ee9c..d90584276a09 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/DepsFileSkipTests.cs @@ -49,10 +49,10 @@ public void RuntimeAssemblyFromRuntimePackCanBeSkipped() { Name = "SkipRuntimeAssemblyFromRuntimePack", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, - IsExe = true + IsExe = true, + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); string filenameToSkip = "Microsoft.CSharp.dll"; @@ -103,10 +103,10 @@ public void NativeAssetFromRuntimePackCanBeSkipped() { Name = "SkipNativeAssetFromRuntimePack", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, - IsExe = true + IsExe = true, + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); string filenameToSkip = FileConstants.DynamicLibPrefix + "coreclr" + FileConstants.DynamicLibSuffix; diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs index 93795ed1cb3e..c9d0ac01f9c8 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs @@ -84,11 +84,11 @@ public void Multiple_frameworks_are_written_to_runtimeconfig_for_self_contained_ { Name = "MultipleFrameworkReferenceTest", TargetFrameworks = tfm, - IsExe = true + IsExe = true, + SelfContained = "true" }; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); - testProject.AdditionalProperties["SelfContained"] = "true"; if (tfm == ToolsetInfo.CurrentTargetFramework) { @@ -430,11 +430,10 @@ public void BuildFailsIfRuntimePackIsNotAvailableForRuntimeIdentifier() Name = "RuntimePackNotAvailable", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "linux-x64" + RuntimeIdentifier = "linux-x64", + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; - var testAsset = _testAssetsManager.CreateTestProject(testProject) .WithProjectChanges(project => { @@ -469,11 +468,10 @@ public void BuildFailsIfInvalidRuntimeIdentifierIsSpecified() Name = "RuntimePackNotAvailable", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "invalid-rid" + RuntimeIdentifier = "invalid-rid", + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; - var testAsset = _testAssetsManager.CreateTestProject(testProject); var restoreCommand = new RestoreCommand(testAsset); @@ -538,7 +536,7 @@ public void RuntimeFrameworkVersionCanBeSpecifiedOnFrameworkReference() string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["RuntimeFrameworkVersion"] = "3.0.0-runtimeframeworkversion-property"; - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; var resolvedVersions = GetResolvedVersions(testProject, project => @@ -571,7 +569,7 @@ public void RuntimeFrameworkVersionCanBeSpecifiedViaProperty() string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["RuntimeFrameworkVersion"] = runtimeFrameworkVersion; - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; var resolvedVersions = GetResolvedVersions(testProject); @@ -596,7 +594,7 @@ public void TargetLatestPatchCanBeSpecifiedOnFrameworkReference(bool attributeVa string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["TargetLatestRuntimePatch"] = (!attributeValue).ToString(); - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; var resolvedVersions = GetResolvedVersions(testProject, project => @@ -633,7 +631,7 @@ public void TargetLatestPatchCanBeSpecifiedViaProperty(bool propertyValue) string targetingPackVersion = "3.0.0-targetingpackversion"; testProject.AdditionalProperties["TargetLatestRuntimePatch"] = propertyValue.ToString(); - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; var resolvedVersions = GetResolvedVersions(testProject, identifier: propertyValue.ToString()); @@ -656,7 +654,7 @@ public void TargetingPackVersionCanBeSpecifiedOnFrameworkReference() var testProject = new TestProject(); string targetingPackVersion = "3.0.0-tpversionfromframeworkreference"; - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; var resolvedVersions = GetResolvedVersions(testProject, project => @@ -827,11 +825,10 @@ public void ResolvedFrameworkReferences_are_generated() Name = "ResolvedFrameworkReferenceTest", IsExe = true, TargetFrameworks = ToolsetInfo.CurrentTargetFramework, - RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid() + RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(), + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; - testProject.FrameworkReferences.Add("Microsoft.AspNetCore.App"); testProject.FrameworkReferences.Add("Microsoft.WindowsDesktop.App"); @@ -985,7 +982,7 @@ private void TestFrameworkReferenceProfiles( if (selfContained) { testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; } string identifier = selfContained ? "_selfcontained" : string.Empty; @@ -1145,7 +1142,7 @@ private ResolvedVersionInfo GetResolvedVersions(TestProject testProject, testProject.TargetFrameworks = targetFramework;; testProject.IsExe = true; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject, callingMethod, identifier); if (projectChanges != null) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs index b2443fad36f3..f874a9e13140 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs @@ -832,10 +832,10 @@ public void It_regenerates_files_if_self_contained_changes() Name = "GenerateFilesTest", TargetFrameworks = TFM, RuntimeIdentifier = runtimeIdentifier, - IsExe = true + IsExe = true, + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; var testAsset = _testAssetsManager .CreateTestProject(testProject); diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 1f245fe4754c..d362d28beaaa 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -260,11 +260,10 @@ static int Last2DigitsTo0(int versionBuild) { IsExe = true, TargetFrameworks = ToolsetInfo.CurrentTargetFramework, - RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid() + RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(), + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; - // Set up test FrameworkReference that will use workload manifest to resolve versions testProject.ProjectChanges.Add(project => { diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs index 5b025a9f3ac9..fb3c3c81694f 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs @@ -326,11 +326,11 @@ public void It_copies_local_all_assets_on_self_contained_build() { Name = ProjectName, TargetFrameworks = ToolsetInfo.CurrentTargetFramework, - IsExe = true + IsExe = true, + SelfContained = "true" }; testProject.AdditionalProperties.Add("RuntimeIdentifier", rid); - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "13.0.1")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs index a38115d8ab02..a04074e93f92 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs @@ -53,7 +53,7 @@ void TestPackagesNotDownloaded(bool referenceAspNet, bool selfContained, [Caller if (selfContained) { testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(); - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; } else { @@ -169,11 +169,10 @@ public void TransitiveFrameworkReferenceGeneratesRuntimePackError() { TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, + SelfContained = "true" }; testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(); - testProject.AdditionalProperties["SelfContained"] = "true"; - testProject.AdditionalProperties["DisableTransitiveFrameworkReferenceDownloads"] = "True"; testProject.AdditionalProperties["RestorePackagesPath"] = nugetPackagesFolder; diff --git a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs index 78bf15acc019..743a039f408b 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs @@ -116,7 +116,7 @@ public void TestGlobalPropertyFlowToExe(bool passSelfContained, bool passRuntime public void TestGlobalPropertyFlowToExeWithSelfContainedFalse(bool passSelfContained, bool passRuntimeIdentifier) { _referencedProject.IsExe = true; - _referencedProject.AdditionalProperties["SelfContained"] = "false"; + _referencedProject.SelfContained = "false"; string identifier = passSelfContained.ToString() + "_" + passRuntimeIdentifier; diff --git a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs index 3d678f3e7f66..f300a24bb121 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs @@ -88,7 +88,7 @@ private void CreateProjects() if (MainSelfContained) { MainProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(); - MainProject.AdditionalProperties["SelfContained"] = "true"; + MainProject.SelfContained = "true"; } ReferencedProject = new TestProject() @@ -102,7 +102,7 @@ private void CreateProjects() if (ReferencedSelfContained) { ReferencedProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(); - ReferencedProject.AdditionalProperties["SelfContained"] = "true"; + ReferencedProject.SelfContained = "true"; } // Use a lower version of a library in the referenced project diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs index cb9154770b0d..70daecc44d63 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs @@ -650,7 +650,7 @@ public void NativeAotStaticLib_only_runs_when_switch_is_enabled(string targetFra testProject.AdditionalProperties["PublishAot"] = "true"; testProject.AdditionalProperties["UseCurrentRuntimeIdentifier"] = "true"; testProject.AdditionalProperties["NativeLib"] = "Static"; - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject); var publishCommand = new PublishCommand(testAsset); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs index 7dfe3a0845a6..f48c5abc6b6f 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishIncrementally.cs @@ -145,10 +145,11 @@ public void It_cleans_before_trimmed_single_file_publish() Name = "RegularPublishToTrimmedSingleExe", TargetFrameworks = ToolsetInfo.CurrentTargetFramework, IsExe = true, - RuntimeIdentifier = "win-x86" + RuntimeIdentifier = "win-x86", + SelfContained = "true" }; + testProject.AdditionalProperties["PublishTrimmed"] = "true"; - testProject.AdditionalProperties["SelfContained"] = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name); // Publish trimmed diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs index 195502fab2b0..27050d7ee038 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs @@ -67,7 +67,7 @@ public void It_creates_readytorun_images_for_all_assemblies_except_excluded_ones "ClassLib"); testProject.AdditionalProperties["PublishReadyToRun"] = "True"; - testProject.AdditionalProperties["SelfContained"] = "True"; + testProject.SelfContained = "True"; testProject.AddItem("PublishReadyToRunExclude", "Include", "Classlib.dll"); var testProjectInstance = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework); @@ -258,7 +258,7 @@ public void It_supports_libraries_when_using_crossgen2(string targetFramework) testProject.AdditionalProperties["PublishReadyToRun"] = "True"; testProject.AdditionalProperties["PublishReadyToRunUseCrossgen2"] = "True"; - testProject.AdditionalProperties["SelfContained"] = "False"; + testProject.SelfContained = "False"; var testProjectInstance = _testAssetsManager.CreateTestProject(testProject, targetFramework); @@ -385,7 +385,7 @@ private void TestProjectPublishing_Internal(string projectName, testProject.AdditionalProperties["PublishReadyToRunEmitSymbols"] = emitNativeSymbols ? "True" : "False"; testProject.AdditionalProperties["PublishReadyToRunUseCrossgen2"] = useCrossgen2 ? "True" : "False"; testProject.AdditionalProperties["PublishReadyToRunComposite"] = composite ? "True" : "False"; - testProject.AdditionalProperties["SelfContained"] = isSelfContained ? "True" : "False"; + testProject.SelfContained = isSelfContained ? "True" : "False"; var testProjectInstance = _testAssetsManager.CreateTestProject(testProject, callingMethod, identifier); @@ -459,10 +459,9 @@ public string Func() IsExe = isExeProject, RuntimeIdentifier = runtimeIdentifier ?? EnvironmentInfo.GetCompatibleRid(targetFramework), ReferencedProjects = { referenceProject }, + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; - testProject.SourceFiles[$"{mainProjectName}.cs"] = @" using System; public class Program diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs index 824f47034ca8..68da390c3d17 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs @@ -74,10 +74,10 @@ public void It_publishes_windows_Forms_app_with_error() { Name = "WinformsErrorPresentFailTest", TargetFrameworks = targetFramework, - IsWinExe = true + IsWinExe = true, + SelfContained = "true" }; testProject.AdditionalProperties["UseWindowsForms"] = "true"; - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.AdditionalProperties["RuntimeIdentifier"] = "win-x64"; testProject.AdditionalProperties["PublishTrimmed"] = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -98,10 +98,10 @@ public void It_publishes_windows_Forms_app_with_error_suppressed() { Name = "WinformsErrorSuppressedPassTest", TargetFrameworks = targetFramework, - IsWinExe = true + IsWinExe = true, + SelfContained = "true" }; testProject.AdditionalProperties["UseWindowsForms"] = "true"; - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.AdditionalProperties["RuntimeIdentifier"] = "win-x64"; testProject.AdditionalProperties["PublishTrimmed"] = "true"; testProject.AdditionalProperties["_SuppressWinFormsTrimError"] = "true"; @@ -171,10 +171,10 @@ public void It_publishes_wpf_app_with_error() { Name = "WpfErrorPresentPassTest", TargetFrameworks = targetFramework, - IsWinExe = true + IsWinExe = true, + SelfContained = "true" }; testProject.AdditionalProperties["UseWPF"] = "true"; - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.AdditionalProperties["RuntimeIdentifier"] = "win-x64"; testProject.AdditionalProperties["PublishTrimmed"] = "true"; var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -195,10 +195,10 @@ public void It_publishes_wpf_app_with_error_Suppressed() { Name = "WpfPassTest", TargetFrameworks = targetFramework, - IsWinExe = true + IsWinExe = true, + SelfContained = "true" }; testProject.AdditionalProperties["UseWPF"] = "true"; - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.AdditionalProperties["RuntimeIdentifier"] = "win-x64"; testProject.AdditionalProperties["_SuppressWpfTrimError"] = "true"; testProject.AdditionalProperties["SuppressTrimAnalysisWarnings"] = "false"; diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs index 7bb84884ad5f..9bac952230db 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishWithoutConflicts.cs @@ -67,9 +67,10 @@ public void It_has_consistent_behavior_when_publishing_single_file(bool shouldPu TargetFrameworks = targetFramework, IsSdkProject = true, IsExe = true, - RuntimeIdentifier = "win-x64" + RuntimeIdentifier = "win-x64", + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; + // The Microsoft.TestPlatform.CLI package contains System.Runtime.CompilerServices.Unsafe.dll as content, which could cause a double write with the same dll originating from the // runtime package. Without _HandleFileConflictsForPublish this would be caught when by the bundler when publishing single file, but a normal publish would succeed with double writes. testProject.PackageReferences.Add(new TestPackageReference("Microsoft.TestPlatform.CLI", "16.5.0")); diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index ed7109ea9846..acb4475620d6 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -1797,10 +1797,10 @@ private TestProject CreateTestProjectWithAnalysisWarnings(string targetFramework { Name = projectName, TargetFrameworks = targetFramework, - IsExe = isExe + IsExe = isExe, + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; // Don't error when generators/analyzers can't be loaded. // This can occur when running tests against FullFramework MSBuild // if the build machine has an MSBuild install with an older version of Roslyn @@ -1873,10 +1873,11 @@ private TestProject CreateTestProjectWithIsTrimmableAttributes( { Name = projectName, TargetFrameworks = targetFramework, - IsExe = true + IsExe = true, + SelfContained = "true" }; + testProject.AdditionalProperties["PublishTrimmed"] = "true"; - testProject.AdditionalProperties["SelfContained"] = "true"; testProject.SourceFiles[$"{projectName}.cs"] = @" using System; public class Program @@ -1989,7 +1990,7 @@ private TestProject CreateTestProjectForILLinkTesting( if (setSelfContained) { - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; } testProject.SourceFiles[$"{mainProjectName}.cs"] = @" diff --git a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs index 986dff7f6b18..f7e4a86ce31f 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs @@ -331,9 +331,10 @@ public void ImplicitRuntimeIdentifierOptOutCorrectlyOptsOut() var testProject = new TestProject() { IsExe = true, - TargetFrameworks = targetFramework + TargetFrameworks = targetFramework, + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.AdditionalProperties["UseCurrentRuntimeIdentifier"] = "false"; var testAsset = _testAssetsManager.CreateTestProject(testProject); diff --git a/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs b/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs index 45ea4b3849c9..c77ac5f0b286 100644 --- a/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs @@ -30,7 +30,7 @@ public void TrimmingOptions_Are_Defaulted_Correctly_On_Trimmed_Apps(string targe var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName); testProject.AdditionalProperties["PublishTrimmed"] = "true"; testProject.AdditionalProperties["RuntimeIdentifier"] = rid; - testProject.AdditionalProperties["SelfContained"] = "true"; + testProject.SelfContained = "true"; testProject.PropertiesToRecord.Add("TrimMode"); var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: projectName + targetFramework); diff --git a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs index f135512867c6..76927e942bf6 100644 --- a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs +++ b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs @@ -35,6 +35,7 @@ public TestProject([CallerMemberName] string name = null) /// public bool IsWinExe { get; set; } + public string ProjectSdk { get; set; } /// @@ -47,6 +48,9 @@ public TestProject([CallerMemberName] string name = null) public string RuntimeIdentifier { get; set; } + // Set to either true, false, or empty string "". The empty string does not undefine SelfContained, it just doesn't specify it. + public string SelfContained { get; set; } = ""; + // TargetFrameworkVersion applies to non-SDK projects public string TargetFrameworkVersion { get; set; } @@ -275,6 +279,11 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder, propertyGroup.Element(ns + "OutputType").SetValue("WinExe"); } + if(this.SelfContained != "") + { + propertyGroup.Add(new XElement(ns + "SelfContained", String.Equals(this.SelfContained, "true", StringComparison.OrdinalIgnoreCase) ? "true" : "false")); + } + if (this.ReferencedProjects.Any()) { var projectReferenceItemGroup = projectXml.Root.Elements(ns + "ItemGroup") diff --git a/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs b/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs index 4399f9a28c7b..74d62e0c28ac 100644 --- a/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs +++ b/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs @@ -204,8 +204,8 @@ public void It_does_not_warn_on_rid_with_self_contained_set_in_project() { IsExe = true, TargetFrameworks = ToolsetInfo.CurrentTargetFramework, + SelfContained = "true" }; - testProject.AdditionalProperties["SelfContained"] = "true"; var testInstance = _testAssetsManager.CreateTestProject(testProject); From fafde81fe60d6a443a97500ac487e9de23c5d2b1 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 28 Apr 2023 17:09:58 -0700 Subject: [PATCH 51/60] Add SelfContained back into the blazor tests because they havent fully patched it it seems and so we have to delay this to preview 5 and id like to make the build green so we can merge it --- .../BlazorHosted/blazorhosted/blazorhosted.csproj | 5 +++++ .../TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj | 5 +++++ .../BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj | 5 +++++ .../BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj | 2 +- .../Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj | 6 +++++- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj index 5099648fae48..e51ae38e412d 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorhosted/blazorhosted.csproj @@ -8,6 +8,11 @@ + + + true + + diff --git a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj index 4f8114d59e1f..63d4c8a12b37 100644 --- a/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorHosted/blazorwasm/blazorwasm.csproj @@ -37,4 +37,9 @@ <_BlazorBrotliCompressionLevel>NoCompression + + + true + + diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj index ec4b53947305..6c4cb4a0e814 100644 --- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj +++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj @@ -14,6 +14,11 @@ + + + true + + diff --git a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj index 30d8b54540ec..dc34774033dc 100644 --- a/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj +++ b/src/Assets/TestProjects/BlazorWasmWithLibrary/blazorwasm/blazorwasm.csproj @@ -36,7 +36,7 @@ <_BlazorBrotliCompressionLevel>NoCompression - + true diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj index a95511329d3c..3aa44ac18b05 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj @@ -14,6 +14,11 @@ false + + + true + + @@ -38,7 +43,6 @@ - From 66806ca138a86cabb0bbc9582ddf187e060b201e Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 1 May 2023 10:08:30 -0700 Subject: [PATCH 52/60] fix remaining tests --- .../EndToEndTests.cs | 2 +- .../Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs index fdfb4f8dc612..5b2fec3cfbc2 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs @@ -81,7 +81,7 @@ public async Task ApiEndToEndWithRegistryPushAndPull() [DockerDaemonAvailableFact] public async Task ApiEndToEndWithLocalLoad() { - string publishDirectory = BuildLocalApp(tfm: "net7.0"); + string publishDirectory = BuildLocalApp(tfm: "net8.0"); // Build the image diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj index 3aa44ac18b05..8747931d7c70 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj @@ -43,6 +43,7 @@ + From 485149e8aefa98638d6444422f54ec77ef07d89b Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 1 May 2023 13:24:57 -0700 Subject: [PATCH 53/60] update container tag to 8 becuase older tfms dont appear to work so I bumped the test tfm --- .../EndToEndTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs index 5b2fec3cfbc2..13131c595ede 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs @@ -89,7 +89,7 @@ public async Task ApiEndToEndWithLocalLoad() ImageBuilder imageBuilder = await registry.GetImageManifestAsync( DockerRegistryManager.RuntimeBaseImage, - DockerRegistryManager.Net7ImageTag, + DockerRegistryManager.Net8PreviewImageTag, "linux-x64", ToolsetUtils.GetRuntimeGraphFilePath(), cancellationToken: default).ConfigureAwait(false); From 5909dd1628f45e33a1afe495770ea9a582f80763 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 2 May 2023 09:10:44 -0700 Subject: [PATCH 54/60] remove the binlog i forgot in the test Co-authored-by: Daniel Plaisted --- src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs index f300a24bb121..4eee13ac748a 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs @@ -147,7 +147,7 @@ private void RunTest(string buildFailureCode = null, [CallerMemberName] string c if (buildFailureCode == null) { - buildOrPublishCommand.Execute("-bl:C:\\users\\noahgilson\\abpublish.binlog") + buildOrPublishCommand.Execute() .Should() .Pass(); From 912ed9f44d453b3f1d693ff1f3fd972b0aa50b25 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 3 May 2023 14:15:04 -0700 Subject: [PATCH 55/60] Change Test for ReferenceExe to not Specify SelfContained if RuntimeIdentifier is Undesired We do this as SelfContained can imply RuntimeIdentifier and before RID used to imply SelfContained, and we want this beahvior to be coupled in this test Co-authored-by: Daniel Plaisted --- .../Microsoft.NET.Build.Tests/ReferenceExeTests.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs index 4eee13ac748a..a526d2a3c5d9 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs @@ -263,11 +263,13 @@ public void ReferencedExeCanRunWhenReferencesExeWithSelfContainedMismatchForDiff { var ns = project.Root.Name.Namespace; - project.Root.Element(ns + "PropertyGroup") - .Add(XElement.Parse($@"" + EnvironmentInfo.GetCompatibleRid() + "")); + var propertyGroup = new XElement(ns + "PropertyGroup", + new XAttribute("Condition", $"'$(TargetFramework)' == '{ToolsetInfo.CurrentTargetFramework}'")); - project.Root.Element(ns + "PropertyGroup") - .Add(new XElement(ns + "SelfContained", "true")); + propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", EnvironmentInfo.GetCompatibleRid())); + propertyGroup.Add(new XElement(ns + "SelfContained", "true")); + + project.Root.Add(propertyGroup); }); From 51920b913727f2552688e780ca0993e26bb6bdd2 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 4 May 2023 11:03:34 -0700 Subject: [PATCH 56/60] Account for targetframework aliases while parsing the target framework to error in older selfcontained exe reference scenarios --- .../ValidateExecutableReferences.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs index 17162b5c86f6..cc9b40e4c4ec 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Versioning; using System.Xml.Linq; using Microsoft.Build.Framework; using NuGet.Frameworks; @@ -58,9 +59,18 @@ protected override void ExecuteCore() bool referencedProjectHadSelfContainedSpecified = MSBuildUtilities.ConvertStringToBool(projectAdditionalProperties["_SelfContainedWasSpecified"]); // We can only access TargetFrameworks and NearestTargetFramework to find the referenced project "TargetFramework". - // We rely on the nearest one because it will pick the lowest 'most-compatible' tfm for the two projects. - // Since 'younger' TFMs are the ones that would error and are generally also what gets picked as 'most-copmaptible' we can use it. - var referencedProjectTargetFramework = NuGetFramework.Parse(nearestTargetFramework); + // We rely on the nearest one because it will pick the lowest 'most-compatible' tfm for the referencer and referencee projects. + // Since 'younger' TFMs are the ones that would error and are generally also what gets picked as 'most-copmaptible,' we can use it. + FrameworkName? referencedProjectTargetFramework = null; + var targetFrameworkMonikerIndex = Array.FindIndex(project.GetMetadata("TargetFrameworks").Split(';'), targetFramework => targetFramework == nearestTargetFramework); + + // Since TargetFrameworks can have aliases that aren't the real TFM, we need to uncover the potential alias to the raw TargetFramework in the TFMs by using its index + var targetFrameworkMonikers = project.GetMetadata("TargetFrameworkMonikers").Split(';'); + if (targetFrameworkMonikerIndex != -1 && targetFrameworkMonikerIndex < targetFrameworkMonikers.Length) + { + // we never expect this if statement to not go through, but if there is a bug with targetframeworks we need to be careful not to fail here. + referencedProjectTargetFramework = new FrameworkName(targetFrameworkMonikers[targetFrameworkMonikerIndex]); + } var globalProperties = BuildEngine6.GetGlobalProperties(); @@ -85,8 +95,8 @@ protected override void ExecuteCore() } // We need to check if referenced project will become SelfContained because of its RuntimeIdentifier. This only happens on TargetFrameworks less than net8.0. - var sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained = NuGetFramework.Parse("net8.0"); - bool runtimeIdentifierInfersSelfContained = referencedProjectTargetFramework.Platform == ".NETCoreApp" && referencedProjectTargetFramework.Version < sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained.Version; + var sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained = new FrameworkName(".NETCoreApp,Version=v8.0"); + bool runtimeIdentifierInfersSelfContained = referencedProjectTargetFramework != null && referencedProjectTargetFramework.Identifier == ".NETCoreApp" && referencedProjectTargetFramework.Version < sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained.Version; // If the project is NOT RID agnostic, then a global RuntimeIdentifier will flow to it. // If the project didn't explicitly specify a value for SelfContained, then this will From aa38fe0e97762510c9a70183292635e9750836a3 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 8 May 2023 09:23:48 -0700 Subject: [PATCH 57/60] Refer to the new variable we created instead of the old one that shouldve been deleted Co-authored-by: Daniel Plaisted --- .../Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs index cc9b40e4c4ec..b7fbd32d6ef8 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs @@ -101,7 +101,7 @@ protected override void ExecuteCore() // If the project is NOT RID agnostic, then a global RuntimeIdentifier will flow to it. // If the project didn't explicitly specify a value for SelfContained, then this will // set SelfContained to true - if (RuntimeIdentifierInfersSelfContained && runtimeIdentifierIsGlobalProperty && !referencedProjectHadSelfContainedSpecified) + if (runtimeIdentifierInfersSelfContained && runtimeIdentifierIsGlobalProperty && !referencedProjectHadSelfContainedSpecified) { referencedProjectIsSelfContained = true; } From 3faa0f22f3114593fdb326c955dc94a661bb4814 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 8 May 2023 09:24:58 -0700 Subject: [PATCH 58/60] Use an integer to compare versions instead of comparing with a created version class to simplify code Co-authored-by: Daniel Plaisted --- .../Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs index b7fbd32d6ef8..8d0416518467 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs @@ -95,8 +95,7 @@ protected override void ExecuteCore() } // We need to check if referenced project will become SelfContained because of its RuntimeIdentifier. This only happens on TargetFrameworks less than net8.0. - var sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained = new FrameworkName(".NETCoreApp,Version=v8.0"); - bool runtimeIdentifierInfersSelfContained = referencedProjectTargetFramework != null && referencedProjectTargetFramework.Identifier == ".NETCoreApp" && referencedProjectTargetFramework.Version < sdkVersionWhereRuntimeIdentifierNoLongerInfersSelfContained.Version; + bool runtimeIdentifierInfersSelfContained = referencedProjectTargetFramework != null && referencedProjectTargetFramework.Identifier == ".NETCoreApp" && referencedProjectTargetFramework.Version.Major < 8; // If the project is NOT RID agnostic, then a global RuntimeIdentifier will flow to it. // If the project didn't explicitly specify a value for SelfContained, then this will From 0415c783ab0dbbf8dc0b281b2b1067c1d9741056 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 8 May 2023 09:29:59 -0700 Subject: [PATCH 59/60] remove unneeeded boolean as we took a different approach to consider tfm aliases --- .../Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs index 8d0416518467..827a548a4bfa 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs @@ -22,8 +22,6 @@ public class ValidateExecutableReferences : TaskBase public bool UseAttributeForTargetFrameworkInfoPropertyNames { get; set; } - public bool RuntimeIdentifierInfersSelfContained { get; set; } - protected override void ExecuteCore() { if (!IsExecutable) From e92dee7410cde0ad9b1946c5ce23cc1103a62029 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 8 May 2023 09:34:32 -0700 Subject: [PATCH 60/60] fix merge conflict that vscode did not save for some reason --- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index b6f546651df7..4e8985251af8 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -822,13 +822,8 @@ The following are names of parameters or literal values and should not be transl NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. -<<<<<<< HEAD - NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. - {StrBegin="NETSDK1179: "} -======= NETSDK1179: '--runtime' を使用する場合は、'--self-contained' または '--no-self-contained' オプションのいずれかが必要です。 {StrBegin="NETSDK1179: "}{Locked="--self-contained"}{Locked="--no-self-contained"}{Locked="--runtime"} ->>>>>>> upstream/main NETSDK1048: 'AdditionalProbingPaths' were specified for GenerateRuntimeConfigurationFiles, but are being skipped because 'RuntimeConfigDevPath' is empty.