From 1fa8f16ed10f2a212b67cc0f088ca37c49f81d8b Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 9 Jul 2025 12:54:11 -0700 Subject: [PATCH 01/32] Support '1.' TFM for CsWinRT 3.0 --- eng/ManualVersions.props | 11 +++++++++++ .../targets/GenerateBundledVersions.targets | 17 +++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/eng/ManualVersions.props b/eng/ManualVersions.props index 9b67e035d26a..9738c1935cc5 100644 --- a/eng/ManualVersions.props +++ b/eng/ManualVersions.props @@ -9,6 +9,17 @@ Basically: In this file, choose the highest version when resolving merge conflicts. --> + + + 10.0.17763.57 + 10.0.18362.57 + 10.0.19041.57 + 10.0.20348.57 + 10.0.22000.57 + 10.0.22621.57 + 10.0.26100.57 + + 10.0.17763.57 10.0.18362.57 10.0.19041.57 diff --git a/src/Layout/redist/targets/GenerateBundledVersions.targets b/src/Layout/redist/targets/GenerateBundledVersions.targets index 9237525dec17..7f5318cd01b3 100644 --- a/src/Layout/redist/targets/GenerateBundledVersions.targets +++ b/src/Layout/redist/targets/GenerateBundledVersions.targets @@ -1316,8 +1316,21 @@ Copyright (c) .NET Foundation. All rights reserved. TargetingPackName="NETStandard.Library.Ref" TargetingPackVersion="$(NETStandardLibraryRefPackageVersion)" /> - - + + + + + + + + + + + From 2ad93023b4fc96865bdd9fe3d732ceaba87501c0 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 9 Jul 2025 13:37:50 -0700 Subject: [PATCH 02/32] Add 'UsingPreviewCsWinRT3_0Feature' warning --- src/Tasks/Common/Resources/Strings.resx | 7 +++++-- 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.Windows.targets | 12 ++++++++++++ 15 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 46d7589727a5..bbebadd53f08 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -875,7 +875,6 @@ You may need to build the project on another operating system or architecture, o NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - {StrBegins="NETSDK1197: "} NETSDK1198: A publish profile with the name '{0}' was not found in the project. Set the PublishProfile property to a valid file name. @@ -995,4 +994,8 @@ You may need to build the project on another operating system or architecture, o NETSDK1228: This project depends on the Aspire Workload which has been deprecated. Aspire now ships via NuGet packages and no longer requires a workload. Please visit {0} for upgrade guidance. {StrBegins="NETSDK1228: "} - + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index e5db44587134..79b3b0cada71 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: K sestavování desktopových aplikací pro Windows se vyžaduje Microsoft.NET.Sdk.WindowsDesktop. Aktuální verze sady SDK nepodporuje hodnoty UseWpf a UseWindowsForms. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: Používáte verzi Preview rozhraní .NET. Viz: https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index c246782b9f1c..589eedc07a2a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Für das Erstellen von Windows-Desktopanwendungen ist Microsoft.NET.Sdk.WindowsDesktop erforderlich. "UseWpf" und "UseWindowsForms" werden vom aktuellen SDK nicht unterstützt. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: Sie verwenden eine Vorschauversion von .NET. Weitere Informationen: https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 0bf7f4613d62..0a14687ca819 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Se requiere Microsoft.NET.Sdk.WindowsDesktop para compilar las aplicaciones de escritorio de Windows. El SDK actual no admite "UseWpf" ni "UseWindowsForms". {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: Está usando una versión preliminar de .NET. Visite: https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index d3f640ff0d76..7661d5070311 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: vous devez disposer de Microsoft.NET.Sdk.WindowsDesktop pour générer des applications de bureau Windows. 'UseWpf' et 'UseWindowsForms' ne sont pas pris en charge par le kit SDK actuel. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: vous utilisez une version d'aperçu de .NET. Voir : https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 6ac472c5fc66..96f5b2ab7974 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: per compilare applicazioni desktop di Windows, è necessario Microsoft.NET.Sdk.WindowsDesktop. 'UseWpf' e 'UseWindowsForms' non sono supportati dall'SDK corrente. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: si sta usando una versione in anteprima di .NET. Vedere https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index bb47aae43458..89481a1d9ff5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Windows デスクトップ アプリケーションを作成するには、Microsoft.NET.Sdk.WindowsDesktop が必要です。現在の SDK では、'UseWpf' と 'UseWindowsForms' はサポートされていません。 {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: プレビュー版の .NET を使用しています。https://aka.ms/dotnet-support-policy をご覧ください diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index b73e728c7177..45b18dbc015f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop을 사용하려면 Windows 데스크톱 애플리케이션을 빌드해야 합니다. 'UseWpf' 및 'UseWindowsForms'는 현재 SDK에서 지원하지 않습니다. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: .NET의 미리 보기 버전을 사용하고 있습니다. 참조: https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 2ab598421867..83a2569fb663 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Do kompilowania aplikacji klasycznych systemu Windows konieczny jest zestaw Microsoft.NET.Sdk.WindowsDesktop. Właściwości „UseWpf” i „UseWindowsForms” nie są obsługiwane przez bieżący zestaw SDK. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: Korzystasz z wersji zapoznawczej platformy .NET. Zobacz: ttps://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 1932439c9340..cd0cf0b24a20 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop é necessário para compilar aplicativos da área de trabalho do Windows. Não há suporte para 'UseWpf' e 'UseWindowsForms' no SDK atual. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: Você está usando uma versão de visualização do .NET. Veja: https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index f8a1ae31c21f..b5aa4f4aca7b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: для сборки классических приложений для Windows требуется Microsoft.NET.Sdk.WindowsDesktop. "UseWpf" и "UseWindowsForms" не поддерживаются текущим пакетом SDK. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: Вы используете предварительную версию .NET. Дополнительные сведения см. на странице https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 9e0915877476..966edca2f615 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: Windows Masaüstü uygulamalarını derlemek için Microsoft.NET.Sdk.WindowsDesktop gereklidir. 'UseWpf' ve 'UseWindowsForms' geçerli SDK tarafından desteklenmiyor. {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: Bir .NET önizleme sürümü kullanıyorsunuz. Bkz. https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 1b093b67114d..ba33dd01d3cf 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: 要构建 Windows 桌面应用程序,需使用 Microsoft.NET.Sdk.WindowsDesktop。当前 SDK 不支持 "UseWpf" 和 "UseWindowsForms"。 {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: 你正在使用 .NET 的预览版。请参阅 https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index a22286f247f4..aa8e45f67284 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -1043,6 +1043,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1107: 需有 Microsoft.NET.Sdk.WindowsDesktop 才能建置 Windows 傳統型應用程式。目前的 SDK 不支援 'UseWpf' 和 'UseWindowsForms'。 {StrBegins="NETSDK1107: "} + + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + {StrBegins="NETSDK1229: "} + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy NETSDK1057: 您目前使用的是 .NET 預覽版。請參閱: https://aka.ms/dotnet-support-policy diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index 644d0faa4658..2c126237bfa6 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -167,4 +167,16 @@ Copyright (c) .NET Foundation. All rights reserved. and '$(UseUwp)' == 'true' "> + + + + + From c25600600fbc705eb7171ab68f62c8889c7c8ac5 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 9 Jul 2025 13:39:28 -0700 Subject: [PATCH 03/32] Add test for new preview warning --- ...ThatWeWantToBuildAWindowsDesktopProject.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs index 9f2d59cbab70..d8c129cf4e5a 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs @@ -478,6 +478,26 @@ public void ItDoesNotWarnAnymoreWhenBuildingAProjectWithUseUwpProperty() .NotHaveStdOutContaining("NETSDK1219"); } + [WindowsOnlyFact] + public void ItWarnsWhenBuildingAProjectTargetingCsWinRT3_0() + { + TestProject testProject = new() + { + Name = "A", + ProjectSdk = "Microsoft.NET.Sdk", + TargetFrameworks = "net10.0-windows10.0.22621.1" + }; + + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Pass() + .And + .NotHaveStdOutContaining("NETSDK1229"); + } + [WindowsOnlyFact] public void ItErrorsWhenTargetingBelowNet6WithUseUwpProperty() { From 4821072e6f4eefc4558c146b3efa1c35b869797a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 9 Jul 2025 13:56:54 -0700 Subject: [PATCH 04/32] Run 'msbuild /t:UpdateXlf' --- 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 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 79b3b0cada71..4e5b591459c8 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: Projekt(y) několika řešení obsahuj(e/í) konfliktní hodnoty „{0}“; ujistěte se, že se hodnoty shodují. Zvažte použití souboru Directory.build.props k nastavení vlastnosti pro všechny projekty. Konfliktní projekty: + NETSDK1197: Projekt(y) několika řešení obsahuj(e/í) konfliktní hodnoty „{0}“; ujistěte se, že se hodnoty shodují. Zvažte použití souboru Directory.build.props k nastavení vlastnosti pro všechny projekty. Konfliktní projekty: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 589eedc07a2a..90c80bb7a38a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: Mehrere Projektmappenprojekte enthalten widersprüchliche Werte für "{0}". Stellen Sie sicher, dass die Werte übereinstimmen. Erwägen Sie die Verwendung einer Directory.build.props-Datei, um die Eigenschaft für alle Projekte festzulegen. In Konflikt stehende Projekte: + NETSDK1197: Mehrere Projektmappenprojekte enthalten widersprüchliche Werte für "{0}". Stellen Sie sicher, dass die Werte übereinstimmen. Erwägen Sie die Verwendung einer Directory.build.props-Datei, um die Eigenschaft für alle Projekte festzulegen. In Konflikt stehende Projekte: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 0a14687ca819..20107e912a1a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: Varios proyectos de solución que contienen valores '{0}' en conflicto; asegúrese de que los valores coinciden. Considere la posibilidad de usar un archivo Directory.build.props para establecer la propiedad para todos los proyectos. Proyectos en conflicto: + NETSDK1197: Varios proyectos de solución que contienen valores '{0}' en conflicto; asegúrese de que los valores coinciden. Considere la posibilidad de usar un archivo Directory.build.props para establecer la propiedad para todos los proyectos. Proyectos en conflicto: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 7661d5070311..ee09bd071ee5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: plusieurs projets de solution contiennent des valeurs '{0}' en conflit ; assurez-vous que les valeurs correspondent. Envisagez d'utiliser un fichier Directory.build.props pour définir la propriété pour tous les projets. Projets conflictuels : + NETSDK1197: plusieurs projets de solution contiennent des valeurs '{0}' en conflit ; assurez-vous que les valeurs correspondent. Envisagez d'utiliser un fichier Directory.build.props pour définir la propriété pour tous les projets. Projets conflictuels : {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 96f5b2ab7974..d161406ddd1d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: più progetti della soluzione contengono valori '{0}' in conflitto. Verificare che i valori corrispondano. Provare a usare un file Directory.build.props per impostare la proprietà di tutti i progetti. Progetti in conflitto: + NETSDK1197: più progetti della soluzione contengono valori '{0}' in conflitto. Verificare che i valori corrispondano. Provare a usare un file Directory.build.props per impostare la proprietà di tutti i progetti. Progetti in conflitto: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 89481a1d9ff5..3c93be7a54ce 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: 複数のソリューションのプロジェクトに、競合する '{0}' 値が含まれています。値が一致するようにしてください。Directory.build.props ファイルを使用して、すべてのプロジェクトのプロパティを設定することを検討してください。競合するプロジェクト: + NETSDK1197: 複数のソリューションのプロジェクトに、競合する '{0}' 値が含まれています。値が一致するようにしてください。Directory.build.props ファイルを使用して、すべてのプロジェクトのプロパティを設定することを検討してください。競合するプロジェクト: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 45b18dbc015f..8a5420710946 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: 여러 솔루션 프로젝트에 충돌하는 '{0}' 값이 있습니다. 값이 일치하는지 확인하세요. Directory.build.props 파일을 사용하여 모든 프로젝트에 대한 속성을 설정하는 것이 좋습니다. 충돌하는 프로젝트: + NETSDK1197: 여러 솔루션 프로젝트에 충돌하는 '{0}' 값이 있습니다. 값이 일치하는지 확인하세요. Directory.build.props 파일을 사용하여 모든 프로젝트에 대한 속성을 설정하는 것이 좋습니다. 충돌하는 프로젝트: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 83a2569fb663..3032f4c2e863 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: Wiele projektów rozwiązań zawiera wartości „{0}” powodujące konflikt; upewnij się, że wartości są zgodne. Rozważ użycie pliku Directory.build.props na potrzeby ustawienia właściwości dla wszystkich projektów. Projekty powodujące konflikt: + NETSDK1197: Wiele projektów rozwiązań zawiera wartości „{0}” powodujące konflikt; upewnij się, że wartości są zgodne. Rozważ użycie pliku Directory.build.props na potrzeby ustawienia właściwości dla wszystkich projektów. Projekty powodujące konflikt: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index cd0cf0b24a20..80d63e09ccdf 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: Vários projetos de solução contêm valores '{0}' conflitantes; garantir que os valores correspondam. Considere usar um arquivo Directory.build.props para configurar a propriedade para todos os projetos. Projetos conflitantes: + NETSDK1197: Vários projetos de solução contêm valores '{0}' conflitantes; garantir que os valores correspondam. Considere usar um arquivo Directory.build.props para configurar a propriedade para todos os projetos. Projetos conflitantes: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index b5aa4f4aca7b..5c99f99a2821 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: несколько проектов решения содержат конфликтующие значения "{0}". Убедитесь, что значения совпадают. Рассмотрите возможность использования файла Directory.build.props для настройки свойства для всех проектов. Конфликтующие проекты: + NETSDK1197: несколько проектов решения содержат конфликтующие значения "{0}". Убедитесь, что значения совпадают. Рассмотрите возможность использования файла Directory.build.props для настройки свойства для всех проектов. Конфликтующие проекты: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 966edca2f615..797e7819f3d4 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: Birden çok çözüm projesi çakışan '{0}' değerleri içeriyor; değerlerin eşleştiğinden emin olun. Özelliği tüm projeler için ayarlamak için Directory.build.props dosyası kullanabilirsiniz. Çakışan projeler: + NETSDK1197: Birden çok çözüm projesi çakışan '{0}' değerleri içeriyor; değerlerin eşleştiğinden emin olun. Özelliği tüm projeler için ayarlamak için Directory.build.props dosyası kullanabilirsiniz. Çakışan projeler: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index ba33dd01d3cf..bc3a782cdc6b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: 多个解决方案项目包含存在冲突的“{0}”值;请确保值能够匹配。请考虑使用 Directory.build.props 文件设置所有项目的属性。存在冲突的项目: + NETSDK1197: 多个解决方案项目包含存在冲突的“{0}”值;请确保值能够匹配。请考虑使用 Directory.build.props 文件设置所有项目的属性。存在冲突的项目: {1} - {StrBegins="NETSDK1197: "} + 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index aa8e45f67284..1c79bd08a394 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -904,9 +904,9 @@ The following are names of parameters or literal values and should not be transl NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} - NETSDK1197: 多個解決方案專案包含衝突的 '{0}' 值; 請確保值相符。考慮使用 Directory.build.props 檔案來設定所有專案的屬性。衝突的專案: + NETSDK1197: 多個解決方案專案包含衝突的 '{0}' 值; 請確保值相符。考慮使用 Directory.build.props 檔案來設定所有專案的屬性。衝突的專案: {1} - {StrBegins="NETSDK1197: "} + 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. From aa2210ea742f380bf4f5ef9d779ce2758e7ffbf5 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 15 Jul 2025 09:35:46 -0700 Subject: [PATCH 05/32] Update 'TargetPlatformVersion' parsing --- .../Microsoft.NET.TargetFrameworkInference.targets | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index 07e579f5f38e..c4c940e378bf 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -65,6 +65,17 @@ Copyright (c) .NET Foundation. All rights reserved. $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 4)) + + + <_TargetPlatformVersionUsesCsWinRT3>false + <_TargetPlatformVersionUsesCsWinRT3 Condition="'$(TargetPlatformIdentifier)' == 'Windows' and $([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true + $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 3)).0 + $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) From ba90d36f198c58f0571c6ca44b89b2124cc6b7c2 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 15 Jul 2025 11:14:30 -0700 Subject: [PATCH 06/32] Update targeting pack selection logic --- .../CreateWindowsSdkKnownFrameworkReferences.cs | 17 +++++++++++++++++ ...NET.Sdk.FrameworkReferenceResolution.targets | 1 + 2 files changed, 18 insertions(+) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs index 17138555aed9..0035cba55652 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs @@ -17,6 +17,8 @@ public class CreateWindowsSdkKnownFrameworkReferences : TaskBase { public bool UseWindowsSDKPreview { get; set; } + public bool UseCsWinRT3 { get; set; } + public string WindowsSdkPackageVersion { get; set; } public string TargetFrameworkIdentifier { get; set; } @@ -76,6 +78,21 @@ protected override void ExecuteCore() continue; } + // If we're using CsWinRT 3.0, filter to only items with '1' as the revision number. + // Otherwise, if we're using CsWinRT 2.0, exclude all of them and pick '0' revisions. + if ((UseCsWinRT3 && windowsSdkVersionParsed.Revision == 0) || + (!UseCsWinRT3 && windowsSdkVersionParsed.Revision == 1)) + { + continue; + } + + // Normalize the revision back to '0' now, as that matches the actual Windows SDK version + windowsSdkVersionParsed = new Version( + windowsSdkVersionParsed.Major, + windowsSdkVersionParsed.Minor, + windowsSdkVersionParsed.Build, + revision: 0); + if (!knownFrameworkReferencesByWindowsSdkVersion.ContainsKey(windowsSdkVersionParsed)) { knownFrameworkReferencesByWindowsSdkVersion[windowsSdkVersionParsed] = new(); diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets index bbcb524d8783..6157e635dbe6 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets @@ -39,6 +39,7 @@ Copyright (c) .NET Foundation. All rights reserved. Date: Tue, 15 Jul 2025 11:41:05 -0700 Subject: [PATCH 07/32] Update '_WarnForCsWinRT3_0PreviewFeatureEnabled' --- 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 ++-- .../targets/Microsoft.NET.TargetFrameworkInference.targets | 1 + .../targets/Microsoft.NET.Windows.targets | 6 +++--- 16 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index bbebadd53f08..8aed4b94ce9d 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -995,7 +995,7 @@ You may need to build the project on another operating system or architecture, o {StrBegins="NETSDK1228: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 4e5b591459c8..fe3e921ff434 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 90c80bb7a38a..0c151084d8c2 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 20107e912a1a..aa3c5856ccc4 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index ee09bd071ee5..1b7e006c246a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index d161406ddd1d..27ca9b58959f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 3c93be7a54ce..91a272f49a58 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 8a5420710946..e68af450895a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 3032f4c2e863..521ea58e1832 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 80d63e09ccdf..fc8f98ca8e3e 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 5c99f99a2821..9cdb65f4ad0c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 797e7819f3d4..c0524675930b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index bc3a782cdc6b..2f7f53147b8b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 1c79bd08a394..2da21edb2171 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -1044,8 +1044,8 @@ The following are names of parameters or literal values and should not be transl {StrBegins="NETSDK1107: "} - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. - NETSDK1229: Targeting a Windows SDK version with '1' as the build number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the build number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. + NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index c4c940e378bf..8b2683f86ce3 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -74,6 +74,7 @@ Copyright (c) .NET Foundation. All rights reserved. --> <_TargetPlatformVersionUsesCsWinRT3>false <_TargetPlatformVersionUsesCsWinRT3 Condition="'$(TargetPlatformIdentifier)' == 'Windows' and $([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true + <_OriginalWindowsTargetPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'Windows'">$(TargetPlatformVersion) $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 3)).0 $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index 2c126237bfa6..2ab077b6f382 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -169,14 +169,14 @@ Copyright (c) .NET Foundation. All rights reserved. + and '$(_TargetPlatformVersionUsesCsWinRT3)' == 'true' "> + FormatArguments="$(_OriginalWindowsTargetPlatformVersion)" /> From 4d465e6add7be72cfe9bb12c7d771a5e5f22fb49 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 16 Jul 2025 14:22:04 -0700 Subject: [PATCH 08/32] Define 'CSWINRT3_0' for CsWinRT 3.0 --- .../targets/Microsoft.NET.Sdk.BeforeCommon.targets | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 0b94c1b0cbb5..738de91b410b 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -211,6 +211,15 @@ Copyright (c) .NET Foundation. All rights reserved. <_ImplicitDefineConstant Include="$(_PlatformIdentifierForImplicitDefine)" /> <_ImplicitDefineConstant Include="$(_PlatformIdentifierForImplicitDefine)$(_PlatformVersionForImplicitDefine)" /> + + + + <_ImplicitDefineConstant Include="CSWINRT3_0" /> + From 676ece8566df0bb8f7e3c6a82ad5fd3f5879fdb8 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 16 Jul 2025 14:24:32 -0700 Subject: [PATCH 09/32] Add unit tests --- ...ThatWeWantToBuildAWindowsDesktopProject.cs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs index d8c129cf4e5a..3077f48aa4e9 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs @@ -498,6 +498,58 @@ public void ItWarnsWhenBuildingAProjectTargetingCsWinRT3_0() .NotHaveStdOutContaining("NETSDK1229"); } + [WindowsOnlyFact] + public void ItImplicitlyDefinesCSWINRT3_0WhenBuildingAProjectTargetingCsWinRT3_0() + { + TestProject testProject = new() + { + Name = "A", + ProjectSdk = "Microsoft.NET.Sdk", + TargetFrameworks = "net10.0-windows10.0.22621.1", + SourceFiles = + { + ["Program.cs"] = """ + #if !CSWINRT3_0 + #error CSWINRT3_0 is not defined + #endif + """ + } + }; + + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Pass(); + } + + [WindowsOnlyFact] + public void ItDoesNotImplicitlyDefineCSWINRT3_0WhenBuildingAProjectNotTargetingCsWinRT3_0() + { + TestProject testProject = new() + { + Name = "A", + ProjectSdk = "Microsoft.NET.Sdk", + TargetFrameworks = "net10.0-windows10.0.22621.0", + SourceFiles = + { + ["Program.cs"] = """ + #if CSWINRT3_0 + #error CSWINRT3_0 is defined + #endif + """ + } + }; + + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Pass(); + } + [WindowsOnlyFact] public void ItErrorsWhenTargetingBelowNet6WithUseUwpProperty() { From 0c68835b28944cba3b62d2330bf8d253e5028d5a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 21 Jul 2025 17:39:42 -0700 Subject: [PATCH 10/32] Revert incorrect 'Strings.resx' change --- src/Tasks/Common/Resources/Strings.resx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 8aed4b94ce9d..29f30cddfaf0 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -875,6 +875,7 @@ You may need to build the project on another operating system or architecture, o NETSDK1197: Multiple solution project(s) contain conflicting '{0}' values; ensure the values match. Consider using a Directory.build.props file to set the property for all projects. Conflicting projects: {1} + {StrBegins="NETSDK1197: "} NETSDK1198: A publish profile with the name '{0}' was not found in the project. Set the PublishProfile property to a valid file name. From 58c260c9c4bab4b337c127d915aa8040e785b750 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 22 Jul 2025 09:28:26 -0700 Subject: [PATCH 11/32] Update .xlf files --- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf | 2 +- src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index fe3e921ff434..87fb9f9eaab1 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: Projekt(y) několika řešení obsahuj(e/í) konfliktní hodnoty „{0}“; ujistěte se, že se hodnoty shodují. Zvažte použití souboru Directory.build.props k nastavení vlastnosti pro všechny projekty. Konfliktní projekty: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 0c151084d8c2..13db3b66ad80 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: Mehrere Projektmappenprojekte enthalten widersprüchliche Werte für "{0}". Stellen Sie sicher, dass die Werte übereinstimmen. Erwägen Sie die Verwendung einer Directory.build.props-Datei, um die Eigenschaft für alle Projekte festzulegen. In Konflikt stehende Projekte: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index aa3c5856ccc4..2ef55a2566fc 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: Varios proyectos de solución que contienen valores '{0}' en conflicto; asegúrese de que los valores coinciden. Considere la posibilidad de usar un archivo Directory.build.props para establecer la propiedad para todos los proyectos. Proyectos en conflicto: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 1b7e006c246a..0b448657cef0 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: plusieurs projets de solution contiennent des valeurs '{0}' en conflit ; assurez-vous que les valeurs correspondent. Envisagez d'utiliser un fichier Directory.build.props pour définir la propriété pour tous les projets. Projets conflictuels : {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 27ca9b58959f..79488754fa36 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: più progetti della soluzione contengono valori '{0}' in conflitto. Verificare che i valori corrispondano. Provare a usare un file Directory.build.props per impostare la proprietà di tutti i progetti. Progetti in conflitto: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 91a272f49a58..343228fa2bc9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: 複数のソリューションのプロジェクトに、競合する '{0}' 値が含まれています。値が一致するようにしてください。Directory.build.props ファイルを使用して、すべてのプロジェクトのプロパティを設定することを検討してください。競合するプロジェクト: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index e68af450895a..c4ba90428660 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: 여러 솔루션 프로젝트에 충돌하는 '{0}' 값이 있습니다. 값이 일치하는지 확인하세요. Directory.build.props 파일을 사용하여 모든 프로젝트에 대한 속성을 설정하는 것이 좋습니다. 충돌하는 프로젝트: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 521ea58e1832..2c6e696d798c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: Wiele projektów rozwiązań zawiera wartości „{0}” powodujące konflikt; upewnij się, że wartości są zgodne. Rozważ użycie pliku Directory.build.props na potrzeby ustawienia właściwości dla wszystkich projektów. Projekty powodujące konflikt: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index fc8f98ca8e3e..7d04fc0bb7a2 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: Vários projetos de solução contêm valores '{0}' conflitantes; garantir que os valores correspondam. Considere usar um arquivo Directory.build.props para configurar a propriedade para todos os projetos. Projetos conflitantes: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 9cdb65f4ad0c..f84dd5880230 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: несколько проектов решения содержат конфликтующие значения "{0}". Убедитесь, что значения совпадают. Рассмотрите возможность использования файла Directory.build.props для настройки свойства для всех проектов. Конфликтующие проекты: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index c0524675930b..4ee9ecf510f5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: Birden çok çözüm projesi çakışan '{0}' değerleri içeriyor; değerlerin eşleştiğinden emin olun. Özelliği tüm projeler için ayarlamak için Directory.build.props dosyası kullanabilirsiniz. Çakışan projeler: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 2f7f53147b8b..7bb3fc2b1645 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: 多个解决方案项目包含存在冲突的“{0}”值;请确保值能够匹配。请考虑使用 Directory.build.props 文件设置所有项目的属性。存在冲突的项目: {1} - + {StrBegins="NETSDK1197: "} 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. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 2da21edb2171..9aa913f6a506 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -906,7 +906,7 @@ The following are names of parameters or literal values and should not be transl {1} NETSDK1197: 多個解決方案專案包含衝突的 '{0}' 值; 請確保值相符。考慮使用 Directory.build.props 檔案來設定所有專案的屬性。衝突的專案: {1} - + {StrBegins="NETSDK1197: "} 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. From d8d8cb04b81301f8b676a6e41eb3625cb0393f00 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 22 Jul 2025 13:53:53 -0700 Subject: [PATCH 12/32] Fix parsing normalized SDK version --- .../targets/Microsoft.NET.TargetFrameworkInference.targets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index 8b2683f86ce3..7520708dc52d 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -75,7 +75,8 @@ Copyright (c) .NET Foundation. All rights reserved. <_TargetPlatformVersionUsesCsWinRT3>false <_TargetPlatformVersionUsesCsWinRT3 Condition="'$(TargetPlatformIdentifier)' == 'Windows' and $([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true <_OriginalWindowsTargetPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'Windows'">$(TargetPlatformVersion) - $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 3)).0 + <_NormalizedWindowsTargetPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'Windows'">$([System.Version]::Parse('$(TargetPlatformVersion)').Major).$([System.Version]::Parse('$(TargetPlatformVersion)').Minor).$([System.Version]::Parse('$(TargetPlatformVersion)').Build).0 + $(_NormalizedWindowsTargetPlatformVersion) $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) From fd4f2749275f84559f01ac057cbd9bf98b905f5d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 8 Aug 2025 13:21:46 -0700 Subject: [PATCH 13/32] Fix framework references creation for '.1' TFM --- .../CreateWindowsSdkKnownFrameworkReferences.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs index 0035cba55652..aa678faff5e3 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs @@ -98,7 +98,16 @@ protected override void ExecuteCore() knownFrameworkReferencesByWindowsSdkVersion[windowsSdkVersionParsed] = new(); } - knownFrameworkReferencesByWindowsSdkVersion[windowsSdkVersionParsed].Add((normalizedMinimumVersion, CreateKnownFrameworkReferences(windowsSdkPackageVersion, TargetFrameworkVersion, supportedWindowsVersion.ItemSpec))); + // We are intentionally using 'Version.ToString(4)' here instead of passing the 'ItemSpec' + // on the current item (even though the version is parsed from it), so that if we are using + // CsWinRT 3.0 and we have reverted the revision number to '0', we will correctly also match + // that in the target platform version string (otherwise that would've been '.1'). + var createdKnownFrameworkReferences = CreateKnownFrameworkReferences( + windowsSdkPackageVersion, + TargetFrameworkVersion, + targetPlatformVersion: windowsSdkVersionParsed.ToString(4)); + + knownFrameworkReferencesByWindowsSdkVersion[windowsSdkVersionParsed].Add((normalizedMinimumVersion, createdKnownFrameworkReferences)); } } From 983f97356dacd42afd0eab48cd52b2142059d732 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 14 Aug 2025 03:02:17 -0700 Subject: [PATCH 14/32] Add unit tests for normalized defines --- ...ThatWeWantToBuildAWindowsDesktopProject.cs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs index 3077f48aa4e9..2baf232e0b8f 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs @@ -550,6 +550,58 @@ public void ItDoesNotImplicitlyDefineCSWINRT3_0WhenBuildingAProjectNotTargetingC .Pass(); } + [WindowsOnlyFact] + public void ItNormalizesWindowsSDKImplicitDefinesWhenBuildingAProjectTargetingCsWinRT3_0() + { + TestProject testProject = new() + { + Name = "A", + ProjectSdk = "Microsoft.NET.Sdk", + TargetFrameworks = "net10.0-windows10.0.22621.1", + SourceFiles = + { + ["Program.cs"] = """ + #if !WINDOWS10_0_22621_0 || !WINDOWS10_0_22621_0_OR_GREATER || WINDOWS10_0_22621_1 || WINDOWS10_0_22621_1_OR_GREATER + #error Incorrect Windows SDK implicit defines + #endif + """ + } + }; + + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Pass(); + } + + [WindowsOnlyFact] + public void ItHasExpectedWindowsSDKImplicitDefinesWhenBuildingAProjectTargetingCsWinRT2_0() + { + TestProject testProject = new() + { + Name = "A", + ProjectSdk = "Microsoft.NET.Sdk", + TargetFrameworks = "net10.0-windows10.0.22621.0", + SourceFiles = + { + ["Program.cs"] = """ + #if !WINDOWS10_0_22621_0 || !WINDOWS10_0_22621_0_OR_GREATER || WINDOWS10_0_22621_1 || WINDOWS10_0_22621_1_OR_GREATER + #error Incorrect Windows SDK implicit defines + #endif + """ + } + }; + + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Pass(); + } + [WindowsOnlyFact] public void ItErrorsWhenTargetingBelowNet6WithUseUwpProperty() { From b38c0924bb36343415fc8d4bb798f61be1584ef8 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 14 Aug 2025 13:20:05 -0400 Subject: [PATCH 15/32] Switch to using profiles in the same framework reference to differentiate between CSWinRT 2 and 3 --- eng/ManualVersions.props | 11 ------- .../targets/GenerateBundledVersions.targets | 17 ++-------- ...reateWindowsSdkKnownFrameworkReferences.cs | 33 +++---------------- ...T.Sdk.FrameworkReferenceResolution.targets | 1 - .../targets/Microsoft.NET.Windows.props | 5 ++- .../targets/Microsoft.NET.Windows.targets | 8 +++-- 6 files changed, 17 insertions(+), 58 deletions(-) diff --git a/eng/ManualVersions.props b/eng/ManualVersions.props index 9738c1935cc5..9b67e035d26a 100644 --- a/eng/ManualVersions.props +++ b/eng/ManualVersions.props @@ -9,17 +9,6 @@ Basically: In this file, choose the highest version when resolving merge conflicts. --> - - - 10.0.17763.57 - 10.0.18362.57 - 10.0.19041.57 - 10.0.20348.57 - 10.0.22000.57 - 10.0.22621.57 - 10.0.26100.57 - - 10.0.17763.57 10.0.18362.57 10.0.19041.57 diff --git a/src/Layout/redist/targets/GenerateBundledVersions.targets b/src/Layout/redist/targets/GenerateBundledVersions.targets index 7f5318cd01b3..9237525dec17 100644 --- a/src/Layout/redist/targets/GenerateBundledVersions.targets +++ b/src/Layout/redist/targets/GenerateBundledVersions.targets @@ -1316,21 +1316,8 @@ Copyright (c) .NET Foundation. All rights reserved. TargetingPackName="NETStandard.Library.Ref" TargetingPackVersion="$(NETStandardLibraryRefPackageVersion)" /> - - - - - - - - - - - + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs index aa678faff5e3..110c5c1d926e 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs @@ -17,8 +17,6 @@ public class CreateWindowsSdkKnownFrameworkReferences : TaskBase { public bool UseWindowsSDKPreview { get; set; } - public bool UseCsWinRT3 { get; set; } - public string WindowsSdkPackageVersion { get; set; } public string TargetFrameworkIdentifier { get; set; } @@ -78,36 +76,12 @@ protected override void ExecuteCore() continue; } - // If we're using CsWinRT 3.0, filter to only items with '1' as the revision number. - // Otherwise, if we're using CsWinRT 2.0, exclude all of them and pick '0' revisions. - if ((UseCsWinRT3 && windowsSdkVersionParsed.Revision == 0) || - (!UseCsWinRT3 && windowsSdkVersionParsed.Revision == 1)) - { - continue; - } - - // Normalize the revision back to '0' now, as that matches the actual Windows SDK version - windowsSdkVersionParsed = new Version( - windowsSdkVersionParsed.Major, - windowsSdkVersionParsed.Minor, - windowsSdkVersionParsed.Build, - revision: 0); - if (!knownFrameworkReferencesByWindowsSdkVersion.ContainsKey(windowsSdkVersionParsed)) { knownFrameworkReferencesByWindowsSdkVersion[windowsSdkVersionParsed] = new(); } - // We are intentionally using 'Version.ToString(4)' here instead of passing the 'ItemSpec' - // on the current item (even though the version is parsed from it), so that if we are using - // CsWinRT 3.0 and we have reverted the revision number to '0', we will correctly also match - // that in the target platform version string (otherwise that would've been '.1'). - var createdKnownFrameworkReferences = CreateKnownFrameworkReferences( - windowsSdkPackageVersion, - TargetFrameworkVersion, - targetPlatformVersion: windowsSdkVersionParsed.ToString(4)); - - knownFrameworkReferencesByWindowsSdkVersion[windowsSdkVersionParsed].Add((normalizedMinimumVersion, createdKnownFrameworkReferences)); + knownFrameworkReferencesByWindowsSdkVersion[windowsSdkVersionParsed].Add((normalizedMinimumVersion, CreateKnownFrameworkReferences(windowsSdkPackageVersion, TargetFrameworkVersion, supportedWindowsVersion.ItemSpec))); } } @@ -125,10 +99,11 @@ protected override void ExecuteCore() private static TaskItem[] CreateKnownFrameworkReferences(string windowsSdkPackageVersion, string targetFrameworkVersion, string targetPlatformVersion) { - // Return three items: + // Return multiple items for different profiles: // - No profile: with the entire Windows SDK (including Windows.UI.Xaml.* types), only used by downlevel .NET SDKs // - "Windows": just the Windows SDK, without anything in Windows.UI.Xaml.* .dll // - "Xaml": just the Windows.UI.Xaml types + // - "Windows2" and "Xaml2": these profiles use the CSWinRT projections // // Note: we still need to return the item with no profile even if unused, so that the filtering logic for profiles will work correctly. return @@ -136,6 +111,8 @@ private static TaskItem[] CreateKnownFrameworkReferences(string windowsSdkPackag CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: null), CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Windows"), CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Xaml"), + CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Windows2"), + CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Xaml2"), ]; } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets index 6157e635dbe6..bbcb524d8783 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets @@ -39,7 +39,6 @@ Copyright (c) .NET Foundation. All rights reserved. - + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index e53c2d78ced6..e7d22562d30e 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -66,8 +66,12 @@ Copyright (c) .NET Foundation. All rights reserved. - - + + + + + + + + + + + + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs index 677418865f0f..a397b6b18b55 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs @@ -116,7 +116,7 @@ private static TaskItem[] CreateKnownFrameworkReferences(string windowsSdkPackag // - No profile: with the entire Windows SDK (including Windows.UI.Xaml.* types), only used by downlevel .NET SDKs // - "Windows": just the Windows SDK, without anything in Windows.UI.Xaml.* .dll // - "Xaml": just the Windows.UI.Xaml types - // - "Windows2" and "Xaml2": these profiles use the CSWinRT projections + // - "CsWinRT3.Windows" and "CsWinRT3.Xaml": these profiles use the CSWinRT projections // // Note: we still need to return the item with no profile even if unused, so that the filtering logic for profiles will work correctly. return @@ -124,8 +124,8 @@ private static TaskItem[] CreateKnownFrameworkReferences(string windowsSdkPackag CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: null), CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Windows"), CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Xaml"), - CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Windows2"), - CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "Xaml2"), + CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "CsWinRT3.Windows"), + CreateKnownFrameworkReference(windowsSdkPackageVersion, targetFrameworkVersion, targetPlatformVersion, profile: "CsWinRT3.Xaml"), ]; } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index 7520708dc52d..56bfc07eba4f 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -74,9 +74,6 @@ Copyright (c) .NET Foundation. All rights reserved. --> <_TargetPlatformVersionUsesCsWinRT3>false <_TargetPlatformVersionUsesCsWinRT3 Condition="'$(TargetPlatformIdentifier)' == 'Windows' and $([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true - <_OriginalWindowsTargetPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'Windows'">$(TargetPlatformVersion) - <_NormalizedWindowsTargetPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'Windows'">$([System.Version]::Parse('$(TargetPlatformVersion)').Major).$([System.Version]::Parse('$(TargetPlatformVersion)').Minor).$([System.Version]::Parse('$(TargetPlatformVersion)').Build).0 - $(_NormalizedWindowsTargetPlatformVersion) $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) From 93d669f5514683924d700b39da1d3c66c5bb4d9a Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Mon, 18 Aug 2025 19:09:41 -0700 Subject: [PATCH 20/32] Fix profile names --- .../Microsoft.NET.Build.Tasks/ResolveRuntimePackAssets.cs | 8 ++++---- .../targets/Microsoft.NET.Windows.props | 2 +- .../targets/Microsoft.NET.Windows.targets | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ResolveRuntimePackAssets.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ResolveRuntimePackAssets.cs index 9915ccf0d216..317f0f217c08 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ResolveRuntimePackAssets.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ResolveRuntimePackAssets.cs @@ -93,14 +93,14 @@ protected override void ExecuteCore() profiles.Add("Xaml"); } - if (FrameworkReferences?.Any(fxReference => fxReference.ItemSpec == "Microsoft.Windows.SDK.NET.Ref.Windows2") == true) + if (FrameworkReferences?.Any(fxReference => fxReference.ItemSpec == "Microsoft.Windows.SDK.NET.Ref.CsWinRT3.Windows") == true) { - profiles.Add("Windows2"); + profiles.Add("CsWinRT3.Windows"); } - if (FrameworkReferences?.Any(fxReference => fxReference.ItemSpec == "Microsoft.Windows.SDK.NET.Ref.Xaml2") == true) + if (FrameworkReferences?.Any(fxReference => fxReference.ItemSpec == "Microsoft.Windows.SDK.NET.Ref.CsWinRT3.Xaml") == true) { - profiles.Add("Xaml2"); + profiles.Add("CsWinRT3.Xaml"); } } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.props b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.props index 26251159461f..d3e75b1f4c78 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.props +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.props @@ -14,7 +14,7 @@ Copyright (c) .NET Foundation. All rights reserved. - diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index e7d22562d30e..46713a2890cc 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -71,7 +71,7 @@ Copyright (c) .NET Foundation. All rights reserved. + Include="Microsoft.Windows.SDK.NET.Ref.CsWinRT3.Xaml" /> + <_PlatformVersionForImplicitDefine Condition=" '$(IncludeWindowsSDKRefFrameworkReferences)' == 'true' and '$(_TargetPlatformVersionUsesCsWinRT3)' == 'true' ">$([System.Text.RegularExpressions.Regex]::Replace($(_PlatformVersionForImplicitDefine), '_1$', '_0')) <_ImplicitDefineConstant Include="$(_PlatformIdentifierForImplicitDefine)" /> @@ -243,7 +245,15 @@ Copyright (c) .NET Foundation. All rights reserved. - <_SupportedPlatformCompatibleVersions Include="@(SdkSupportedTargetPlatformVersion)" Condition=" %(Identity) != '' and $([MSBuild]::VersionLessThanOrEquals(%(Identity), $(TargetPlatformVersion))) " /> + + <_SupportedPlatformCompatibleVersions Include="@(SdkSupportedTargetPlatformVersion)" + Condition=" %(Identity) != '' and '%(SdkSupportedTargetPlatformVersion.NormalizedSupportedTargetPlatformVersion)' == '' and $([MSBuild]::VersionLessThanOrEquals(%(Identity), $(TargetPlatformVersion))) " /> + <_SupportedPlatformCompatibleVersions Include="@(SdkSupportedTargetPlatformVersion->'%(NormalizedSupportedTargetPlatformVersion)')" + Condition=" '%(SdkSupportedTargetPlatformVersion.NormalizedSupportedTargetPlatformVersion)' != '' and $([MSBuild]::VersionLessThanOrEquals('%(SdkSupportedTargetPlatformVersion.NormalizedSupportedTargetPlatformVersion)', $(TargetPlatformVersion))) " /> <_ImplicitDefineConstant Include="@(_SupportedPlatformCompatibleVersions->Distinct()->'$(TargetPlatformIdentifier.ToUpper())%(Identity)_OR_GREATER'->Replace('.', '_'))" /> diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props index 34439118b427..81b1047d31d3 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props @@ -22,7 +22,12 @@ Copyright (c) .NET Foundation. All rights reserved. - - + + + <_NormalizedWindowsSdkSupportedTargetPlatformVersion Include="@(WindowsSdkSupportedTargetPlatformVersion)"> + $([System.Version]::Parse('%(Identity)').Major).$([System.Version]::Parse('%(Identity)').Minor).$([System.Version]::Parse('%(Identity)').Build).0 + + From 95fdd4b9dc3a01b08ef4e3a8d5b72655de5b39fb Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Tue, 19 Aug 2025 08:49:35 -0700 Subject: [PATCH 22/32] Fix SupportedOSPlatformVersion and tests --- .../targets/Microsoft.NET.Sdk.BeforeCommon.targets | 5 ++--- .../targets/Microsoft.NET.Sdk.targets | 3 ++- .../Microsoft.NET.TargetFrameworkInference.targets | 3 ++- .../targets/Microsoft.NET.Windows.targets | 4 ++++ .../GivenThatWeWantToBuildAWindowsDesktopProject.cs | 11 ++++++++++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 2fe0cccebe45..567e061e5bb9 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -205,9 +205,8 @@ Copyright (c) .NET Foundation. All rights reserved. Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetPlatformIdentifier)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0)) " > <_PlatformIdentifierForImplicitDefine>$(TargetPlatformIdentifier.ToUpperInvariant()) - <_PlatformVersionForImplicitDefine>$(TargetPlatformVersion.Replace('.', '_')) - - <_PlatformVersionForImplicitDefine Condition=" '$(IncludeWindowsSDKRefFrameworkReferences)' == 'true' and '$(_TargetPlatformVersionUsesCsWinRT3)' == 'true' ">$([System.Text.RegularExpressions.Regex]::Replace($(_PlatformVersionForImplicitDefine), '_1$', '_0')) + <_PlatformVersionForImplicitDefine Condition="'$(EffectiveTargetPlatformVersion)' != ''">$(EffectiveTargetPlatformVersion.Replace('.', '_')) + <_PlatformVersionForImplicitDefine Condition="'$(EffectiveTargetPlatformVersion)' == ''">$(TargetPlatformVersion.Replace('.', '_')) <_ImplicitDefineConstant Include="$(_PlatformIdentifierForImplicitDefine)" /> 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 08a659ee9fb6..42de115a6a98 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 @@ -1499,7 +1499,8 @@ Copyright (c) .NET Foundation. All rights reserved. - $(TargetPlatformVersion) + $(EffectiveTargetPlatformVersion) + $(TargetPlatformVersion) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index 56bfc07eba4f..af7bc4c46119 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -73,7 +73,8 @@ Copyright (c) .NET Foundation. All rights reserved. immediately reset the revision number back to '.0' so that the rest of the tooling continues to see the same version as before. --> <_TargetPlatformVersionUsesCsWinRT3>false - <_TargetPlatformVersionUsesCsWinRT3 Condition="'$(TargetPlatformIdentifier)' == 'Windows' and $([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true + <_TargetPlatformVersionUsesCsWinRT3 Condition="'$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' != '' and $([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true + $([System.Version]::Parse('$(TargetPlatformVersion)').Major).$([System.Version]::Parse('$(TargetPlatformVersion)').Minor).$([System.Version]::Parse('$(TargetPlatformVersion)').Build).0 $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index 46713a2890cc..50ca01ffad57 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -40,6 +40,10 @@ Copyright (c) .NET Foundation. All rights reserved. $(TargetPlatformMinVersion) $(SupportedOSPlatformVersion) + + $(EffectiveTargetPlatformVersion) + $(EffectiveTargetPlatformVersion) + $(TargetPlatformVersion) $(TargetPlatformVersion) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs index 08bbb8ccc278..39a8fb83130e 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs @@ -487,6 +487,8 @@ public void ItWarnsWhenBuildingAProjectTargetingCsWinRT3_0() ProjectSdk = "Microsoft.NET.Sdk", TargetFrameworks = "net10.0-windows10.0.22621.1" }; + // Disabling until CsWinRTGen is available. + testProject.AdditionalProperties["CsWinRTGenerateInteropAssembly"] = "false"; var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -495,7 +497,7 @@ public void ItWarnsWhenBuildingAProjectTargetingCsWinRT3_0() .Should() .Pass() .And - .NotHaveStdOutContaining("NETSDK1229"); + .HaveStdOutContaining("NETSDK1229"); } [WindowsOnlyFact] @@ -515,6 +517,8 @@ public void ItImplicitlyDefinesCSWINRT3_0WhenBuildingAProjectTargetingCsWinRT3_0 """ } }; + // Disabling until CsWinRTGen is available. + testProject.AdditionalProperties["CsWinRTGenerateInteropAssembly"] = "false"; var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -567,6 +571,9 @@ public void ItNormalizesWindowsSDKImplicitDefinesWhenBuildingAProjectTargetingCs """ } }; + // Disabling until CsWinRTGen is available. + testProject.AdditionalProperties["CsWinRTGenerateInteropAssembly"] = "false"; + var testAsset = _testAssetsManager.CreateTestProject(testProject); @@ -759,6 +766,8 @@ public void ItCanMultiTargetCSWinRT2And3() SelfContained = "true", RuntimeIdentifier = "win-x64" }; + // Disabling until CsWinRTGen is available. + testProject.AdditionalProperties["CsWinRTGenerateInteropAssembly"] = "false"; var testAsset = _testAssetsManager.CreateTestProject(testProject); From 0787215fb099cf3406effa1149af00311b2b64ee Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Tue, 19 Aug 2025 16:39:37 -0700 Subject: [PATCH 23/32] Fix tests and always set EffectiveTargetPlatformVersion --- .../targets/Microsoft.NET.Sdk.BeforeCommon.targets | 3 +-- .../targets/Microsoft.NET.Sdk.targets | 4 ++-- .../Microsoft.NET.TargetFrameworkInference.targets | 9 ++++++--- .../targets/Microsoft.NET.Windows.targets | 7 ++----- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 567e061e5bb9..03551d1f1440 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -205,8 +205,7 @@ Copyright (c) .NET Foundation. All rights reserved. Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetPlatformIdentifier)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0)) " > <_PlatformIdentifierForImplicitDefine>$(TargetPlatformIdentifier.ToUpperInvariant()) - <_PlatformVersionForImplicitDefine Condition="'$(EffectiveTargetPlatformVersion)' != ''">$(EffectiveTargetPlatformVersion.Replace('.', '_')) - <_PlatformVersionForImplicitDefine Condition="'$(EffectiveTargetPlatformVersion)' == ''">$(TargetPlatformVersion.Replace('.', '_')) + <_PlatformVersionForImplicitDefine>$(EffectiveTargetPlatformVersion.Replace('.', '_')) <_ImplicitDefineConstant Include="$(_PlatformIdentifierForImplicitDefine)" /> 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 42de115a6a98..a620593ceda8 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 @@ -1493,14 +1493,14 @@ Copyright (c) .NET Foundation. All rights reserved. weren't included in the TargetPlatformMoniker for restore, obscuring the errors about unknown platforms or missing workloads. --> 0.0 + $(TargetPlatformVersion) $(TargetPlatformIdentifier),Version=$(TargetPlatformVersion) $([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformSDKDisplayName($(TargetPlatformIdentifier), $(TargetPlatformVersion))) - $(EffectiveTargetPlatformVersion) - $(TargetPlatformVersion) + $(EffectiveTargetPlatformVersion) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index af7bc4c46119..e28c7793b932 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -57,6 +57,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_TargetFrameworkVersionWithoutV>$(TargetFrameworkVersion.TrimStart('vV')) + $(TargetPlatformVersion) <_TargetPlatformVersionUsesCsWinRT3>false <_TargetPlatformVersionUsesCsWinRT3 Condition="'$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' != '' and $([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true - $([System.Version]::Parse('$(TargetPlatformVersion)').Major).$([System.Version]::Parse('$(TargetPlatformVersion)').Minor).$([System.Version]::Parse('$(TargetPlatformVersion)').Build).0 + $([System.Version]::Parse('$(TargetPlatformVersion)').Major).$([System.Version]::Parse('$(TargetPlatformVersion)').Minor).$([System.Version]::Parse('$(TargetPlatformVersion)').Build).0 $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) + $(TargetPlatformVersion) Windows diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index 50ca01ffad57..de769380ef45 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -32,6 +32,7 @@ Copyright (c) .NET Foundation. All rights reserved. 7.0 + $(TargetPlatformVersion) @@ -40,13 +41,9 @@ Copyright (c) .NET Foundation. All rights reserved. $(TargetPlatformMinVersion) $(SupportedOSPlatformVersion) - + $(EffectiveTargetPlatformVersion) $(EffectiveTargetPlatformVersion) - - - $(TargetPlatformVersion) - $(TargetPlatformVersion) From 2dffc351c6f7fec3770648bc2ab612070774208a Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Tue, 19 Aug 2025 20:22:22 -0700 Subject: [PATCH 24/32] Fix TargetPlatformVersion being set in Directory.Build.targets --- .../targets/Microsoft.NET.Sdk.targets | 6 +++++- ...Microsoft.NET.TargetFrameworkInference.targets | 3 +-- .../targets/Microsoft.NET.Windows.targets | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) 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 a620593ceda8..e557003b02d4 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 @@ -1493,11 +1493,15 @@ Copyright (c) .NET Foundation. All rights reserved. weren't included in the TargetPlatformMoniker for restore, obscuring the errors about unknown platforms or missing workloads. --> 0.0 - $(TargetPlatformVersion) $(TargetPlatformIdentifier),Version=$(TargetPlatformVersion) $([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformSDKDisplayName($(TargetPlatformIdentifier), $(TargetPlatformVersion))) + + + $(TargetPlatformVersion) + + $(EffectiveTargetPlatformVersion) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index e28c7793b932..1dadaf19c08b 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -57,7 +57,6 @@ Copyright (c) .NET Foundation. All rights reserved. <_TargetFrameworkVersionWithoutV>$(TargetFrameworkVersion.TrimStart('vV')) - $(TargetPlatformVersion) Windows diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets index de769380ef45..19f9cdcf9a65 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets @@ -29,6 +29,21 @@ Copyright (c) .NET Foundation. All rights reserved. true + + + + <_TargetPlatformVersionUsesCsWinRT3 Condition="$([System.Version]::Parse('$(TargetPlatformVersion)').Revision) == 1">true + $([System.Version]::Parse('$(TargetPlatformVersion)').Major).$([System.Version]::Parse('$(TargetPlatformVersion)').Minor).$([System.Version]::Parse('$(TargetPlatformVersion)').Build).0 + $(TargetPlatformVersion) + + 7.0 From ffbdf9eb59f666c3055f8b1905a70e00d18ab80f Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Wed, 20 Aug 2025 15:23:59 -0700 Subject: [PATCH 25/32] Apply suggestion from @dsplaisted Co-authored-by: Daniel Plaisted --- .../targets/Microsoft.NET.TargetFrameworkInference.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index 1dadaf19c08b..57ac3804a631 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -79,7 +79,7 @@ Copyright (c) .NET Foundation. All rights reserved. $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) - $(TargetPlatformVersion) + $(TargetPlatformVersion) Windows From 8d29560ef788b231d697863dfc9ed9c61e6aaee4 Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Wed, 20 Aug 2025 17:30:10 -0700 Subject: [PATCH 26/32] Fix typo --- .../targets/Microsoft.NET.TargetFrameworkInference.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets index 57ac3804a631..08e5f714b4f6 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets @@ -79,7 +79,7 @@ Copyright (c) .NET Foundation. All rights reserved. $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 2)) - $(TargetPlatformVersion) + $(TargetPlatformVersion) Windows From 62fa6b696e71921ea3d6d8216180547aaf4990de Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Wed, 20 Aug 2025 18:31:13 -0700 Subject: [PATCH 27/32] Use version parse instead --- .../Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props index 81b1047d31d3..0a33b09d81f8 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props @@ -26,7 +26,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_NormalizedWindowsSdkSupportedTargetPlatformVersion Include="@(WindowsSdkSupportedTargetPlatformVersion)"> $([System.Version]::Parse('%(Identity)').Major).$([System.Version]::Parse('%(Identity)').Minor).$([System.Version]::Parse('%(Identity)').Build).0 + Condition="$([System.Version]::Parse('%(Identity)').Revision) == 1">$([System.Version]::Parse('%(Identity)').Major).$([System.Version]::Parse('%(Identity)').Minor).$([System.Version]::Parse('%(Identity)').Build).0 From 09e3f53d52129a18fa6a986f082ca2b4daa00f58 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 27 Aug 2025 13:43:51 -0400 Subject: [PATCH 28/32] Add tests and additional error case for WindowsSdkPackageMinimumRevision --- src/Tasks/Common/Resources/Strings.resx | 8 ++- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.de.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.es.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.it.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 5 ++ .../Common/Resources/xlf/Strings.pt-BR.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 5 ++ src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 5 ++ .../Common/Resources/xlf/Strings.zh-Hans.xlf | 5 ++ .../Common/Resources/xlf/Strings.zh-Hant.xlf | 5 ++ ...reateWindowsSdkKnownFrameworkReferences.cs | 14 +++++ ...ThatWeWantToBuildAWindowsDesktopProject.cs | 54 +++++++++++++++++++ 16 files changed, 139 insertions(+), 2 deletions(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 29f30cddfaf0..8bd022cc5c4b 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -982,7 +982,6 @@ You may need to build the project on another operating system or architecture, o NETSDK1225: Native compilation is not supported when invoking the Publish target directly. Try running dotnet publish. {StrBegins="NETSDK1225: "} - NETSDK1226: Prune Package data not found {0} {1} {2}. To ignore this error, set the AllowMissingPrunePackageData to true. {StrBegins="NETSDK1226: "} @@ -999,4 +998,9 @@ You may need to build the project on another operating system or architecture, o NETSDK1229: Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is currently in preview. The current project is targeting the Windows SDK version '{0}'. If this is not intended, change the revision number to '0' to use CsWinRT 2.x instead. {StrBegins="NETSDK1229: "} - \ No newline at end of file + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + + + diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 87fb9f9eaab1..33eefab224e0 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -212,6 +212,11 @@ NETSDK1125: Publikování do jednoho souboru se podporuje jen pro cíl netcoreapp. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Volí se {0}, protože verze sestavení {1} je větší než {2}. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 13db3b66ad80..de8cd2d4dcd6 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -212,6 +212,11 @@ NETSDK1125: Das Veröffentlichen in einer einzelnen Datei wird nur für das netcoreapp-Ziel unterstützt. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Auswahl von "{0}", weil AssemblyVersion {1} höher ist als {2}. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 2ef55a2566fc..992d17ed0e87 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -212,6 +212,11 @@ NETSDK1125: La publicación en un único archivo solo se admite para el destino netcoreapp. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Se elegirá "{0}" porque AssemblyVersion "{1}" es mayor que "{2}". diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 0b448657cef0..f1fa539c671d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -212,6 +212,11 @@ NETSDK1125: la publication sur un seul fichier est uniquement prise en charge pour une cible netcoreapp. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. '{0}' choisi, car AssemblyVersion '{1}' est supérieur à '{2}'. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 79488754fa36..80df52af6e60 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -212,6 +212,11 @@ NETSDK1125: la pubblicazione in un file singolo è supportata solo per la destinazione netcoreapp. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Verrà scelto '{0}' perché il valore di AssemblyVersion '{1}' è maggiore di '{2}'. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 343228fa2bc9..0855513cab25 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -212,6 +212,11 @@ NETSDK1125: 1 つのファイルへの発行は netcoreapp ターゲットでのみサポートされています。 {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. AssemblyVersion '{1}' が '{2}' より大きいため、'{0}' を選択しています。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index c4ba90428660..3af9fd77229c 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -212,6 +212,11 @@ NETSDK1125: 단일 파일에 게시는 netcoreapp 대상에만 지원됩니다. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. AssemblyVersion '{1}'이(가) '{2}'보다 크기 때문에 '{0}'을(를) 선택합니다. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 2c6e696d798c..9075e67ffbdb 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -212,6 +212,11 @@ NETSDK1125: Publikowanie do pojedynczego pliku jest obsługiwane tylko w przypadku elementu docelowego netcoreapp. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Zostanie wybrany element „{0}”, ponieważ wartość atrybutu AssemblyVersion „{1}” jest większa niż „{2}”. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 7d04fc0bb7a2..6018e8c57fe3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -212,6 +212,11 @@ NETSDK1125: há suporte para a publicação em um único arquivo somente para o destino netcoreapp. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Escolhendo '{0}' porque AssemblyVersion '{1}' é maior que '{2}'. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index f84dd5880230..200069017dc3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -212,6 +212,11 @@ NETSDK1125: публикация в один файл поддерживается только для целевой платформы netcoreapp. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. Используется "{0}", так как значение AssemblyVersion "{1}" больше "{2}". diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 4ee9ecf510f5..aa99e0293764 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -212,6 +212,11 @@ NETSDK1125: Tek dosyada yayımlama yalnızca netcoreapp hedefi için desteklenir. {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. '{1}' AssemblyVersion değeri '{2}' değerinden büyük olduğundan '{0}' seçiliyor. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 7bb3fc2b1645..5823f6b3bdbe 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -212,6 +212,11 @@ NETSDK1125: 仅 netcoreapp 目标支持发布到单个文件。 {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. 选择“{0}”,因为 AssemblyVersion“{1}”高于“{2}”。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 9aa913f6a506..cf81a058e906 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -212,6 +212,11 @@ NETSDK1125: 只有 netcoreapp 目標支援發行到單一檔案。 {StrBegins="NETSDK1125: "} + + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + NETSDK1230: The {0} and {1} properties cannot both be specified. Remove one or the other. + {StrBegins="NETSDK1230: "} + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. 因為 AssemblyVersion '{1}' 大於 '{2}',所以選擇 '{0}'。 diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs index a397b6b18b55..814248f08205 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CreateWindowsSdkKnownFrameworkReferences.cs @@ -38,6 +38,20 @@ protected override void ExecuteCore() { List knownFrameworkReferences = new(); + if (!string.IsNullOrEmpty(WindowsSdkPackageMinimumRevision)) + { + if (!string.IsNullOrEmpty(WindowsSdkPackageVersion)) + { + Log.LogError(Strings.CantSpecifyBothProperties, nameof(WindowsSdkPackageVersion), nameof(WindowsSdkPackageMinimumRevision)); + return; + } + if (UseWindowsSDKPreview) + { + Log.LogError(Strings.CantSpecifyBothProperties, nameof(UseWindowsSDKPreview), nameof(WindowsSdkPackageMinimumRevision)); + return; + } + } + if (!string.IsNullOrEmpty(WindowsSdkPackageVersion)) { knownFrameworkReferences.AddRange(CreateKnownFrameworkReferences(WindowsSdkPackageVersion, TargetFrameworkVersion, TargetPlatformVersion)); diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs index 39a8fb83130e..7072d0731eea 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs @@ -773,7 +773,61 @@ public void ItCanMultiTargetCSWinRT2And3() var buildCommand = new BuildCommand(testAsset); buildCommand.Execute().Should().Pass(); + } + + [WindowsOnlyTheory] + [InlineData("57", "10.0.19041.57")] + [InlineData("50", "10.0.19041.55")] + public void MinimumWindowsSdkPackagRevisionCanBeSet(string minimumRevision, string expectedPackageVersion) + { + var testProject = new TestProject() + { + TargetFrameworks = $"{ToolsetInfo.CurrentTargetFramework}-windows10.0.19041.0" + }; + testProject.AdditionalProperties["WindowsSdkPackageMinimumRevision"] = minimumRevision; + var testAsset = _testAssetsManager.CreateTestProject(testProject); + File.WriteAllText(Path.Combine(testAsset.TestRoot, "Directory.Build.targets"), """ + + + + + + + + + + + + + +"""); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Pass(); + string referencedWindowsSdkVersion = GetReferencedWindowsSdkVersion(testAsset); + referencedWindowsSdkVersion.Should().Be(expectedPackageVersion); + } + + [WindowsOnlyFact] + public void WindowsSdkPackageVersionAndMinimumRevisionCannotBothBeSpecified() + { + var testProject = new TestProject() + { + TargetFrameworks = $"{ToolsetInfo.CurrentTargetFramework}-windows10.0.19041.0" + }; + testProject.AdditionalProperties["WindowsSdkPackageVersion"] = "10.0.19041.55"; + testProject.AdditionalProperties["WindowsSdkPackageMinimumRevision"] = "57"; + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var buildCommand = new BuildCommand(testAsset); + buildCommand.Execute() + .Should() + .Fail() + .And + .HaveStdOutContaining("NETSDK1230"); } private string GetReferencedWindowsSdkVersion(TestAsset testAsset) From 45d1d9b934953a0ac669f1012bd17ec342bb3b4c Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 3 Sep 2025 21:04:42 -0400 Subject: [PATCH 29/32] Collect binlog for test --- .../GivenThatWeWantToBuildAWindowsDesktopProject.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs index 7072d0731eea..382259bff48c 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs @@ -578,7 +578,9 @@ public void ItNormalizesWindowsSDKImplicitDefinesWhenBuildingAProjectTargetingCs var testAsset = _testAssetsManager.CreateTestProject(testProject); var buildCommand = new BuildCommand(testAsset); - buildCommand.Execute() + buildCommand + .WithWorkingDirectory(testAsset.TestRoot) + .Execute("-bl") .Should() .Pass(); } From dd54f2a611da85aa303bbed2c82c2938dc93be26 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Fri, 5 Sep 2025 16:33:10 -0400 Subject: [PATCH 30/32] Copilot implementation of new logic for stage 2 bundled versions Copilot prompt #1: Replace the #class:'Microsoft.DotNet.Build.Tasks.OverrideAndCreateBundledNETCoreAppPackageVersion':1164-10242 Task. The new version should take as parameters the path to the stage 0 bundled versions file as well as the version from stage 2. It should copy some version numbers from items in the stage 0 version to the stage 2 version, and then save the updated stage 2 version. It should update items where the TargetFramework metadata is not the latest target framework supported. There are multiple item types that need to be updated, and they need to be matched on specific metadata. KnownFrameworkReference: match on Include, TargetFramework metadata. Update LatestRuntimeFrameworkVersion and TargetingPackVersion KnownAppHostPack: match on Include, TargetFramework metadata. Update AppHostPackVersion KnownCrossgen2Pack: match on Include, TargetFramework. Update Crossgen2PackVersion KnownILCompilerPack: match on Include, TargetFramework. Update ILCompilerPackVersion KnownRuntimePack: match on Include, TargetFramework, RuntimePackLabels. Update LatestRuntimeFrameworkVersion KnownILLinkPack: match on Include, TargetFramework. Update ILLinkPackVersion. If there is more than one match based on the specified metadata, generate an error. For the metadata which is not used to match and is not updated, if the value differs between the stage 0 and stage 2 versions, log a message. Copilot prompt #2: Don't look at just the first ItemGroup in each file, load items from all ItemGroups found. When looking for the latest target framework, use the NuGetFramework class to parse the TargetFramework values, and to compare them. --- ...ndCreateBundledNETCoreAppPackageVersion.cs | 247 ++++++------------ 1 file changed, 76 insertions(+), 171 deletions(-) diff --git a/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs b/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs index 06445c959111..a9f489f8f554 100644 --- a/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs +++ b/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs @@ -9,196 +9,101 @@ using System.Xml.Linq; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -using NuGet.Versioning; +using System.Collections.Generic; +using NuGet.Frameworks; namespace Microsoft.DotNet.Build.Tasks { /// - /// Use the runtime in dotnet/sdk instead of in the stage 0 to avoid circular dependency. - /// If there is a change depended on the latest runtime. Without override the runtime version in BundledNETCoreAppPackageVersion - /// we would need to somehow get this change in without the test, and then insertion dotnet/installer - /// and then update the stage 0 back. - /// - /// Override NETCoreSdkVersion to stage 0 sdk version like 6.0.100-dev - /// Override NETCoreSdkRuntimeIdentifier and NETCoreSdkPortableRuntimeIdentifier to match the target RID - /// - /// Use a task to override since it was generated as a string literal replace anyway. - /// And using C# can have better error when anything goes wrong. + /// Updates version numbers in the stage 2 bundled versions file by copying values from the stage 0 file + /// for items where the TargetFramework is not the latest supported. Matches and updates multiple item types. /// public sealed class OverrideAndCreateBundledNETCoreAppPackageVersion : Task { - private static string _messageWhenMismatch = - "{0} version {1} does not match BundledNETCoreAppPackageVersion {2}. " + - "The schema of https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets might change. " + - "We need to ensure we can swap the runtime version from what's in stage0 to what dotnet/sdk used successfully"; - - [Required] public string Stage0MicrosoftNETCoreAppRefPackageVersionPath { get; set; } - - [Required] public string MicrosoftNETCoreAppRefPackageVersion { get; set; } - - [Required] public string NewSDKVersion { get; set; } - - [Required] public string TargetRid { get; set; } - + [Required] public string Stage0BundledVersionsPath { get; set; } + [Required] public string Stage2BundledVersionsPath { get; set; } [Required] public string OutputPath { get; set; } public override bool Execute() { - File.WriteAllText(OutputPath, - ExecuteInternal( - File.ReadAllText(Stage0MicrosoftNETCoreAppRefPackageVersionPath), - MicrosoftNETCoreAppRefPackageVersion, - NewSDKVersion, - TargetRid, - Log)); - return true; - } - - public static string ExecuteInternal( - string stage0MicrosoftNETCoreAppRefPackageVersionContent, - string microsoftNETCoreAppRefPackageVersion, - string newSDKVersion, - string targetRid, - TaskLoggingHelper log) - { - var projectXml = XDocument.Parse(stage0MicrosoftNETCoreAppRefPackageVersionContent); - - var ns = projectXml.Root.Name.Namespace; - - var propertyGroup = projectXml.Root.Elements(ns + "PropertyGroup").First(); - - propertyGroup.Element(ns + "NETCoreSdkVersion").Value = newSDKVersion; - propertyGroup.Element(ns + "NETCoreSdkRuntimeIdentifier").Value = targetRid; - propertyGroup.Element(ns + "NETCoreSdkPortableRuntimeIdentifier").Value = targetRid; - - - var originalBundledNETCoreAppPackageVersion = propertyGroup.Element(ns + "BundledNETCoreAppPackageVersion").Value; - var parsedOriginalBundledPackageVersion = SemanticVersion.Parse(originalBundledNETCoreAppPackageVersion); - var parsedMicrosoftNETCoreAppRefPackageVersion = - SemanticVersion.Parse(microsoftNETCoreAppRefPackageVersion); - - // In the case where we have a new major version, it'll come in first through the dotnet/runtime flow of the - // SDK's own package references. The Stage0 SDK's bundled version props file will still be on the older major version - // (and the older TFM that goes along with that). If we just replaced the bundled version with the new major version, - // apps that target the 'older' TFM would fail to build. So we need to keep the bundled version from the existing - // bundledversions.props in this one specific case. - - var newBundledPackageVersion = - parsedOriginalBundledPackageVersion.Major == parsedMicrosoftNETCoreAppRefPackageVersion.Major - ? microsoftNETCoreAppRefPackageVersion - : originalBundledNETCoreAppPackageVersion; - - propertyGroup.Element(ns + "BundledNETCoreAppPackageVersion").Value = newBundledPackageVersion; - - var isNETServicing = IsNETServicing(originalBundledNETCoreAppPackageVersion); - var currentTargetFramework = $"net{parsedMicrosoftNETCoreAppRefPackageVersion.Major}.0"; - - void CheckAndReplaceElement(XElement element) + try { - if (element.Value != originalBundledNETCoreAppPackageVersion) + var stage0Doc = XDocument.Load(Stage0BundledVersionsPath); + var stage2Doc = XDocument.Load(Stage2BundledVersionsPath); + var ns = stage2Doc.Root.Name.Namespace; + + // Load all items from all ItemGroups + var items2 = stage2Doc.Root.Elements(ns + "ItemGroup").SelectMany(ig => ig.Elements()).ToList(); + var items0 = stage0Doc.Root.Elements(ns + "ItemGroup").SelectMany(ig => ig.Elements()).ToList(); + + // Find latest TargetFramework using NuGetFramework + var allTargetFrameworks = items2 + .Select(e => e.Attribute("TargetFramework")?.Value) + .Where(v => !string.IsNullOrEmpty(v)) + .Distinct() + .Select(tf => new { Raw = tf, Parsed = NuGetFramework.Parse(tf) }) + .ToList(); + var latest = allTargetFrameworks + .OrderByDescending(tf => tf.Parsed, NuGetFramework.Comparer) + .FirstOrDefault(); + var latestTargetFramework = latest?.Raw; + + // Helper for matching and updating + void UpdateItems(string elementName, string[] matchAttrs, string[] updateAttrs) { - throw new InvalidOperationException(string.Format( - _messageWhenMismatch, - element.ToString(), element.Value, originalBundledNETCoreAppPackageVersion)); + var items2Filtered = items2 + .Where(e => e.Name.LocalName == elementName && e.Attribute("TargetFramework")?.Value != latestTargetFramework) + .ToList(); + foreach (var item2 in items2Filtered) + { + var matches0 = items0 + .Where(e => e.Name.LocalName == elementName && matchAttrs.All(attr => (e.Attribute(attr)?.Value ?? "") == (item2.Attribute(attr)?.Value ?? ""))) + .ToList(); + if (matches0.Count == 0) + { + Log.LogError($"No matching {elementName} in stage 0 for: {string.Join(", ", matchAttrs.Select(a => $"{a}={item2.Attribute(a)?.Value}"))}"); + continue; + } + if (matches0.Count > 1) + { + Log.LogError($"Multiple matches for {elementName} in stage 0 for: {string.Join(", ", matchAttrs.Select(a => $"{a}={item2.Attribute(a)?.Value}"))}"); + continue; + } + var item0 = matches0[0]; + foreach (var updateAttr in updateAttrs) + { + var v0 = item0.Attribute(updateAttr)?.Value; + var v2 = item2.Attribute(updateAttr)?.Value; + if (v0 != null && v2 != v0) + item2.SetAttributeValue(updateAttr, v0); + } + // Log if other metadata differs + foreach (var attr in item2.Attributes()) + { + if (matchAttrs.Contains(attr.Name.LocalName) || updateAttrs.Contains(attr.Name.LocalName)) + continue; + var v0 = item0.Attribute(attr.Name)?.Value; + if (v0 != null && v0 != attr.Value) + Log.LogMessage(MessageImportance.Low, $"{elementName} {string.Join(", ", matchAttrs.Select(a => $"{a}={item2.Attribute(a)?.Value}"))}: Metadata '{attr.Name}' differs: stage0='{v0}', stage2='{attr.Value}'"); + } + } } - log.LogMessage(MessageImportance.High, - $"Replacing element {element.Name} value '{element.Value}' with '{newBundledPackageVersion}'"); - element.Value = newBundledPackageVersion; - } + UpdateItems("KnownFrameworkReference", new[] { "Include", "TargetFramework" }, new[] { "LatestRuntimeFrameworkVersion", "TargetingPackVersion" }); + UpdateItems("KnownAppHostPack", new[] { "Include", "TargetFramework" }, new[] { "AppHostPackVersion" }); + UpdateItems("KnownCrossgen2Pack", new[] { "Include", "TargetFramework" }, new[] { "Crossgen2PackVersion" }); + UpdateItems("KnownILCompilerPack", new[] { "Include", "TargetFramework" }, new[] { "ILCompilerPackVersion" }); + UpdateItems("KnownRuntimePack", new[] { "Include", "TargetFramework", "RuntimePackLabels" }, new[] { "LatestRuntimeFrameworkVersion" }); + UpdateItems("KnownILLinkPack", new[] { "Include", "TargetFramework" }, new[] { "ILLinkPackVersion" }); - void CheckAndReplaceAttribute(XAttribute attribute) - { - if (attribute.Value != originalBundledNETCoreAppPackageVersion) - { - throw new InvalidOperationException(string.Format( - _messageWhenMismatch, - attribute.Parent.ToString() + " --- " + attribute.ToString(), attribute.Value, - originalBundledNETCoreAppPackageVersion)); - } - - log.LogMessage(MessageImportance.High, - $"Replacing attribute {attribute.Name} value '{attribute.Value}' with '{newBundledPackageVersion}' in element {attribute.Parent.Name}"); - attribute.Value = newBundledPackageVersion; + stage2Doc.Save(OutputPath); + return !Log.HasLoggedErrors; } - - if (!isNETServicing) + catch (Exception ex) { - CheckAndReplaceElement(propertyGroup.Element(ns + "BundledNETCorePlatformsPackageVersion")); + Log.LogErrorFromException(ex, true); + return false; } - - var itemGroup = projectXml.Root.Elements(ns + "ItemGroup").First(); - - if (!isNETServicing) - { - foreach (var element in itemGroup.Elements(ns + "KnownFrameworkReference") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("DefaultRuntimeFrameworkVersion")); - CheckAndReplaceAttribute(element.Attribute("TargetingPackVersion")); - } - } - - foreach (var element in itemGroup.Elements(ns + "KnownFrameworkReference") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("LatestRuntimeFrameworkVersion")); - } - foreach (var element in itemGroup.Elements(ns + "KnownAppHostPack") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("AppHostPackVersion")); - } - - foreach (var element in itemGroup.Elements(ns + "KnownCrossgen2Pack") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("Crossgen2PackVersion")); - } - - foreach (var element in itemGroup.Elements(ns + "KnownILCompilerPack") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("ILCompilerPackVersion")); - } - - foreach (var element in itemGroup.Elements(ns + "KnownILLinkPack") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("ILLinkPackVersion")); - } - - // web assembly packs always use the latest regardless of the TFM - foreach (var element in itemGroup.Elements(ns + "KnownWebAssemblySdkPack")) - { - CheckAndReplaceAttribute(element.Attribute("WebAssemblySdkPackVersion")); - } - - foreach (var element in itemGroup.Elements(ns + "KnownAspNetCorePack") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("AspNetCorePackVersion")); - } - - foreach (var element in itemGroup.Elements(ns + "KnownRuntimePack") - .Where(e => e.Attribute("TargetFramework")?.Value == currentTargetFramework)) - { - CheckAndReplaceAttribute(element.Attribute("LatestRuntimeFrameworkVersion")); - } - - return projectXml.ToString(); - } - - /// - /// For SDK servicing, few Attributes like "DefaultRuntimeFrameworkVersion" does not use the latest flowed version - /// so there is no need to replace them. - /// - /// - private static bool IsNETServicing(string netVersion) - { - var parsedSdkVersion = NuGet.Versioning.NuGetVersion.Parse(netVersion); - - return !parsedSdkVersion.IsPrerelease; } } } From f61552633fcc622cd9f64e2adc47ae71edc097c6 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Fri, 5 Sep 2025 16:45:24 -0400 Subject: [PATCH 31/32] Fixup/edits to copilot code --- src/Layout/redist/targets/OverlaySdkOnLKG.targets | 7 ++----- ...errideAndCreateBundledNETCoreAppPackageVersion.cs | 12 +++++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Layout/redist/targets/OverlaySdkOnLKG.targets b/src/Layout/redist/targets/OverlaySdkOnLKG.targets index 406f81137c2f..19505de69d50 100644 --- a/src/Layout/redist/targets/OverlaySdkOnLKG.targets +++ b/src/Layout/redist/targets/OverlaySdkOnLKG.targets @@ -37,11 +37,8 @@ UseHardLinksIfPossible="true" /> + Stage0BundledVersionsPath="$(_DotNetHiveRoot)/sdk/$(Stage0SdkVersion)/Microsoft.NETCoreSdk.BundledVersions.props" + Stage2BundledVersionsPath="$(TestHostDotNetRoot)/sdk/$(Version)/Microsoft.NETCoreSdk.BundledVersions.props"/> - /// Updates version numbers in the stage 2 bundled versions file by copying values from the stage 0 file - /// for items where the TargetFramework is not the latest supported. Matches and updates multiple item types. + /// For stage 2, we want use the version numbers from stage 0 for the downlevel .NET versions. This is because + /// the latest patches of different major versions are built entirely separately, and we want to have tests + /// on downlevel versions but we can't depend on the latest patches being available in test environments. + /// + /// So we copy the version numbers from stage 0 for those downlevel versions. /// public sealed class OverrideAndCreateBundledNETCoreAppPackageVersion : Task { [Required] public string Stage0BundledVersionsPath { get; set; } [Required] public string Stage2BundledVersionsPath { get; set; } - [Required] public string OutputPath { get; set; } public override bool Execute() { @@ -44,7 +46,7 @@ public override bool Execute() .Select(tf => new { Raw = tf, Parsed = NuGetFramework.Parse(tf) }) .ToList(); var latest = allTargetFrameworks - .OrderByDescending(tf => tf.Parsed, NuGetFramework.Comparer) + .OrderByDescending(tf => tf.Parsed.Version) .FirstOrDefault(); var latestTargetFramework = latest?.Raw; @@ -96,7 +98,7 @@ void UpdateItems(string elementName, string[] matchAttrs, string[] updateAttrs) UpdateItems("KnownRuntimePack", new[] { "Include", "TargetFramework", "RuntimePackLabels" }, new[] { "LatestRuntimeFrameworkVersion" }); UpdateItems("KnownILLinkPack", new[] { "Include", "TargetFramework" }, new[] { "ILLinkPackVersion" }); - stage2Doc.Save(OutputPath); + stage2Doc.Save(Stage2BundledVersionsPath); return !Log.HasLoggedErrors; } catch (Exception ex) From 670d7fc690e4f1029486efae78901a1308326106 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 16 Sep 2025 13:37:57 -0400 Subject: [PATCH 32/32] Remove unnecessary usings --- .../OverrideAndCreateBundledNETCoreAppPackageVersion.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs b/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs index ba4cc47edcb1..842c867d7180 100644 --- a/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs +++ b/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs @@ -3,13 +3,6 @@ #nullable disable -using System; -using System.IO; -using System.Linq; -using System.Xml.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.Collections.Generic; using NuGet.Frameworks; namespace Microsoft.DotNet.Build.Tasks