diff --git a/eng/restore-toolset.ps1 b/eng/restore-toolset.ps1
index 38854e4dc10a..353b2d817ae3 100644
--- a/eng/restore-toolset.ps1
+++ b/eng/restore-toolset.ps1
@@ -1,6 +1,6 @@
function InitializeCustomSDKToolset {
if ($env:TestFullMSBuild -eq "true") {
- $env:DOTNET_SDK_TEST_MSBUILD_PATH = InitializeVisualStudioMSBuild -install:$false -vsRequirements:$GlobalJson.tools.'vs-opt'
+ $env:DOTNET_SDK_TEST_MSBUILD_PATH = InitializeVisualStudioMSBuild -install:$true -vsRequirements:$GlobalJson.tools.'vs-opt'
Write-Host "INFO: Tests will run against full MSBuild in $env:DOTNET_SDK_TEST_MSBUILD_PATH"
}
diff --git a/global.json b/global.json
index 7538e2e725c6..295d0a1010dd 100644
--- a/global.json
+++ b/global.json
@@ -7,8 +7,9 @@
]
},
"vs-opt": {
- "version": "15.9"
- }
+ "version": "16.8"
+ },
+ "xcopy-msbuild": "16.8.0-preview1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20364.3",
diff --git a/src/Layout/redist/minimumMSBuildVersion b/src/Layout/redist/minimumMSBuildVersion
index 28ebe8b4dbed..93eef160e899 100644
--- a/src/Layout/redist/minimumMSBuildVersion
+++ b/src/Layout/redist/minimumMSBuildVersion
@@ -1 +1 @@
-16.5.0
+16.8.0
diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx
index 601b71a4685f..781d470c54bf 100644
--- a/src/Tasks/Common/Resources/Strings.resx
+++ b/src/Tasks/Common/Resources/Strings.resx
@@ -645,4 +645,8 @@ The following are names of parameters or literal values and should not be transl
NETSDK1135: MinimumOSPlatform {0} cannot be higher than TargetPlatformVersion {1}.{StrBegin="NETSDK1135: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+
diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
index 06750ade56ab..969179b064ab 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: Aktuální sada .NET SDK nepodporuje cílení {0} {1}. Buď zacilte {0} {2} nebo nižší, nebo použijte verzi sady .NET SDK, která podporuje {0} {1}.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.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.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf
index 535a63f51e5f..2bb5b725a4f7 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: Das aktuelle .NET SDK unterstützt {0} {1} nicht als Ziel. Geben Sie entweder {0} {2} oder niedriger als Ziel an, oder verwenden Sie eine .NET SDK-Version, die {0} {1} unterstützt.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: Für das Erstellen von Windows-Desktopanwendungen ist Microsoft.NET.Sdk.WindowsDesktop erforderlich. "UseWpf" und "UseWindowsForms" werden vom aktuellen SDK nicht unterstützt.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf
index d2afbfd9ffaa..73a9ede99c45 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: El SDK de .NET actual no admite el destino {0} {1}. Use el destino {0} {2} u otro inferior, o bien una versión del SDK de .NET que admita {0} {1}.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: Se requiere Microsoft.NET.Sdk.WindowsDesktop para compilar las aplicaciones de escritorio de Windows. El SDK actual no admite "UseWpf" ni "UseWindowsForms".
diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
index 5dfaea0e334c..c931edf111eb 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: Le kit .NET SDK actuel ne prend pas en charge le ciblage de {0} {1}. Vous devez soit cibler {0} {2} ou une version antérieure, soit utiliser une version du kit .NET SDK qui prend en charge {0} {1}.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.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.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf
index 36d11beb7419..dbba9f121586 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: la versione corrente di .NET SDK non supporta {0} {1} come destinazione. Impostare come destinazione {0} {2} o una versione precedente oppure usare una versione di .NET SDK che supporta {0} {1}.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: per compilare applicazioni desktop di Windows, è necessario Microsoft.NET.Sdk.WindowsDesktop. 'UseWpf' e 'UseWindowsForms' non sono supportati dall'SDK corrente.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
index 0e572735f072..4a101ac116d9 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: 現在の .NET SDK は、ターゲットとする {0} {1} をサポートしていません。{0} {2} 以下をターゲットとするか、{0} {1} をサポートする .NET SDK のバージョンを使用してください。{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: Windows デスクトップ アプリケーションを作成するには、Microsoft.NET.Sdk.WindowsDesktop が必要です。現在の SDK では、'UseWpf' と 'UseWindowsForms' はサポートされていません。
diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
index 4cd99c4657cd..fef722efb5ec 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: 현재 .NET SDK에서는 {0} {1}을(를) 대상으로 하는 것을 지원하지 않습니다. {0} {2} 이하를 대상으로 하거나 {0} {1}을(를) 지원하는 .NET SDK 버전을 사용하세요.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop을 사용하려면 Windows 데스크톱 애플리케이션을 빌드해야 합니다. 'UseWpf' 및 'UseWindowsForms'는 현재 SDK에서 지원하지 않습니다.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
index 1113f83e0f10..4ec935337000 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: Bieżący zestaw .NET SDK nie obsługuje używania środowiska docelowego {0} {1}. Użyj jako środowiska docelowego wersji {0} {2} lub starszej albo użyj wersji zestawu .NET SDK obsługującej środowisko {0} {1}.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.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.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
index 00ad13e2732f..0ffbf625fa54 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: O SDK do .NET atual não dá suporte para direcionar a {0} {1}. Direcione a {0} {2} ou inferior, ou use uma versão do SDK do .NET compatível com {0} {1}.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.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.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
index 07ccbc789bd1..a44802c3bcb1 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: текущий пакет SDK для .NET не поддерживает целевой объект {0} {1}. Выберите {0} {2} или более раннюю версию либо используйте версию пакета SDK для .NET, которая поддерживает {0} {1}.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: для сборки классических приложений для Windows требуется Microsoft.NET.Sdk.WindowsDesktop. "UseWpf" и "UseWindowsForms" не поддерживаются текущим пакетом SDK.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
index 06de6bdfa4c0..858cfe54f888 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: Geçerli .NET SDK’sı {0} {1} sürümünü hedeflemeyi desteklemiyor. {0} {2} veya daha düşük bir sürümü hedefleyin veya {0} {1} destekleyen bir .NET SDK’sı kullanın.{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: Windows Masaüstü uygulamalarını derlemek için Microsoft.NET.Sdk.WindowsDesktop gereklidir. 'UseWpf' ve 'UseWindowsForms' geçerli SDK tarafından desteklenmiyor.
diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
index a91bd03ef909..fdb27871687c 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: 当前 .NET SDK 不支持将 {0} {1} 设置为目标。请将 {0} {2} 或更低版本设置为目标,或使用支持 {0} {1} 的 .NET SDK 版本。{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: 要构建 Windows 桌面应用程序,需使用 Microsoft.NET.Sdk.WindowsDesktop。当前 SDK 不支持 "UseWpf" 和 "UseWindowsForms"。
diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
index df5e41d975fb..5b2271fb1b1a 100644
--- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
+++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
@@ -643,6 +643,11 @@ The following are names of parameters or literal values and should not be transl
NETSDK1045: 目前的 .NET SDK 不支援以 {0} {1} 作為目標。請以 {0} {2} 或更低版本作為目標,或是使用支援 {0} {1} 的 .NET SDK 版本。{StrBegin="NETSDK1045: "}
+
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ NETSDK1136: The target platform identifier {0} was not recognized.
+ {StrBegin="NETSDK1136: "}
+ NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK.NETSDK1107: 需有 Microsoft.NET.Sdk.WindowsDesktop 才能建置 Windows 傳統型應用程式。目前的 SDK 不支援 'UseWpf' 和 'UseWindowsForms'。
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 6a93ed54cc29..ede74b176a7b 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
@@ -46,36 +46,28 @@ Copyright (c) .NET Foundation. All rights reserved.
-
-
- <_ShortFrameworkIdentifier>$(TargetFramework.TrimEnd('.0123456789'))
- <_ShortFrameworkVersion>$(TargetFramework.Substring($(_ShortFrameworkIdentifier.Length)))
-
-
-
-
- v$(_ShortFrameworkVersion)
-
+
+
-
-
- v$(_ShortFrameworkVersion[0]).0
- v$(_ShortFrameworkVersion[0]).$(_ShortFrameworkVersion[1])
- v$(_ShortFrameworkVersion[0]).$(_ShortFrameworkVersion[1]).$(_ShortFrameworkVersion[2])
+ $([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)'))
+ v$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)', 3))
+ <_TargetFrameworkVersionLength Condition="$(TargetFrameworkVersion.EndsWith('.0'))" >$([MSBuild]::Subtract($(TargetFrameworkVersion.Length), 2))
+ $(TargetFrameworkVersion.Substring(0, $(_TargetFrameworkVersionLength)))
-
-
-
- .NETStandard
- .NETCoreApp
-
- .NETFramework
- .NETCoreApp
+
+
+ $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))
+ $([MSBuild]::GetTargetPlatformVersion('$(TargetFramework)', 3))
+
+ <_TargetPlatformVersionLength Condition="$(TargetPlatformVersion.EndsWith('.0'))" >$([MSBuild]::Subtract($(TargetPlatformVersion.Length), 2))
+ $(TargetPlatformVersion.Substring(0, $(_TargetPlatformVersionLength)))
+
+ Windows
-
+
<_UnsupportedTargetFrameworkError>true
@@ -114,6 +106,19 @@ Copyright (c) .NET Foundation. All rights reserved.
FormatArguments="$([MSBuild]::Escape('$(TargetFramework)'))" />
+
+
+
+ true
+
+
+
+
+
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
index 9a7a9901b0f2..b86bf20d17e2 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
@@ -23,5 +23,8 @@ Copyright (c) .NET Foundation. All rights reserved.
7.0
+
+ Windows,Version=7.0
+ Windows 7.0
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliNonLibraryProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliNonLibraryProject.cs
index 0b6fa90a7106..a77c0b9fd15c 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliNonLibraryProject.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliNonLibraryProject.cs
@@ -20,7 +20,7 @@ public GivenThatWeWantToBuildACppCliNonLibraryProject(ITestOutputHelper log) : b
{
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void Given_an_exe_project_It_should_fail_with_error_message()
{
var testAsset = _testAssetsManager
@@ -34,7 +34,7 @@ public void Given_an_exe_project_It_should_fail_with_error_message()
.And.HaveStdOutContaining(Strings.NoSupportCppNonDynamicLibraryDotnetCore);
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void Given_an_StaticLibrary_project_It_should_fail_with_error_message()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliProject.cs
index f2741dece790..3bf65f2a8c49 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliProject.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACppCliProject.cs
@@ -78,7 +78,7 @@ public void Given_Wpf_framework_reference_It_builds_cpp_project()
.Pass();
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void It_fails_with_error_message_on_EnableComHosting()
{
var testAsset = _testAssetsManager
@@ -106,7 +106,7 @@ public void It_fails_with_error_message_on_EnableComHosting()
.HaveStdOutContaining(Strings.NoSupportCppEnableComHosting);
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void It_fails_with_error_message_on_fullframework()
{
var testAsset = _testAssetsManager
@@ -123,7 +123,7 @@ public void It_fails_with_error_message_on_fullframework()
.HaveStdOutContaining(Strings.NETFrameworkWithoutUsingNETSdkDefaults);
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void It_fails_with_error_message_on_tfm_lower_than_3_1()
{
var testAsset = _testAssetsManager
@@ -140,7 +140,7 @@ public void It_fails_with_error_message_on_tfm_lower_than_3_1()
.HaveStdOutContaining(Strings.CppRequiresTFMVersion31);
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void When_run_with_selfcontained_It_fails_with_error_message()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
index 6be2a8fc7d86..05d8170581d6 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
@@ -442,6 +442,8 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform(
propGroup.Add(platformIdentifier);
var platformVersion = new XElement(ns + "TargetPlatformVersion", targetPlatformVersion);
propGroup.Add(platformVersion);
+ var platformSupported = new XElement(ns + "TargetPlatformSupported", true);
+ propGroup.Add(platformSupported);
var disableUnnecessaryImplicitFrameworkReferencesForThisTest = new XElement(ns + "DisableImplicitFrameworkReferences", "true");
propGroup.Add(disableUnnecessaryImplicitFrameworkReferencesForThisTest);
});
@@ -471,6 +473,8 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform_
propGroup.Add(platformIdentifier);
var platformVersion = new XElement(ns + "TargetPlatformVersion", targetPlatformVersion);
propGroup.Add(platformVersion);
+ var platformSupported = new XElement(ns + "TargetPlatformSupported", true);
+ propGroup.Add(platformSupported);
var disableUnnecessaryImplicitFrameworkReferencesForThisTest = new XElement(ns + "DisableImplicitFrameworkReferences", "true");
propGroup.Add(disableUnnecessaryImplicitFrameworkReferencesForThisTest);
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs
index 4787d3170f71..de03a97b2a33 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs
@@ -38,8 +38,10 @@ public void WhenPropertiesAreSetItCanGenerateMinimumOSPlatformAttribute()
var targetPlatformIdentifier = "iOS";
testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
+ testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
testProject.AdditionalProperties["MinimumOSPlatform"] = "13.2";
testProject.AdditionalProperties["TargetPlatformVersion"] = "14.0";
+ testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
var testAsset = _testAssetsManager.CreateTestProject(testProject);
@@ -57,7 +59,9 @@ public void WhenMinimumOSPlatformISNotSetTargetPlatformVersionIsSetItCanGenerate
var targetPlatformIdentifier = "iOS";
testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
+ testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
testProject.AdditionalProperties["TargetPlatformVersion"] = "13.2";
+ testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
var testAsset = _testAssetsManager.CreateTestProject(testProject);
@@ -75,8 +79,10 @@ public void WhenMinimumOSPlatformIsHigherThanTargetPlatformVersionItShouldError(
var targetPlatformIdentifier = "iOS";
testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
+ testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
testProject.AdditionalProperties["TargetPlatformVersion"] = "13.2";
testProject.AdditionalProperties["MinimumOSPlatform"] = "14.0";
+ testProject.AdditionalProperties["TargetPlatformSupported"] = "true";
var testAsset = _testAssetsManager.CreateTestProject(testProject);
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildWithATargetPlatform.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildWithATargetPlatform.cs
new file mode 100644
index 000000000000..9f35771dd8bc
--- /dev/null
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildWithATargetPlatform.cs
@@ -0,0 +1,84 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using Microsoft.NET.TestFramework;
+using Microsoft.NET.TestFramework.Assertions;
+using Microsoft.NET.TestFramework.Commands;
+using Xunit;
+using FluentAssertions;
+using Xunit.Abstractions;
+using Microsoft.NET.TestFramework.ProjectConstruction;
+using System.IO;
+using System;
+
+namespace Microsoft.NET.Build.Tests
+{
+ public class GivenThatWeWantToBuildWithATargetPlatform : SdkTest
+ {
+ public GivenThatWeWantToBuildWithATargetPlatform(ITestOutputHelper log) : base(log)
+ {
+ }
+
+ [WindowsOnlyTheory]
+ [InlineData("netcoreapp3.1", ".NETCoreApp", "v3.1", "Windows", "7.0")] // Default values pre-5.0
+ [InlineData("net5.0", ".NETCoreApp", "v5.0", "Windows", "7.0")]
+ [InlineData("net5.0-Windows7.0", ".NETCoreApp", "v5.0", "Windows", "7.0")]
+ [InlineData("net5.0-WINDOWS7.0", ".NETCoreApp", "v5.0", "Windows", "7.0")]
+ [InlineData("net5.0-windows", ".NETCoreApp", "v5.0", "Windows", "7.0")]
+ [InlineData("net5.0-windows10.0.19041", ".NETCoreApp", "v5.0", "Windows", "10.0.19041")]
+ public void It_defines_target_platform_from_target_framework(string targetFramework, string expectedTargetFrameworkIdentifier, string expectedTargetFrameworkVersion, string expectedTargetPlatformIdentifier, string expectedTargetPlatformVersion)
+ {
+ var testProj = new TestProject()
+ {
+ Name = "TargetPlatformTests",
+ IsSdkProject = true,
+ TargetFrameworks = targetFramework
+ };
+ var testAsset = _testAssetsManager.CreateTestProject(testProj);
+
+ Action assertValue = (string valueName, string expected) =>
+ {
+ var getValuesCommand = new GetValuesCommand(Log, Path.Combine(testAsset.Path, testProj.Name), targetFramework, valueName);
+ getValuesCommand
+ .Execute()
+ .Should()
+ .Pass();
+ if (expected.Trim().Equals(string.Empty))
+ {
+ getValuesCommand.GetValues().Count.Should().Be(0);
+ }
+ else
+ {
+ getValuesCommand.GetValues().ShouldBeEquivalentTo(new[] { expected });
+ }
+ };
+
+ assertValue("TargetFrameworkIdentifier", expectedTargetFrameworkIdentifier);
+ assertValue("TargetFrameworkVersion", expectedTargetFrameworkVersion);
+ assertValue("TargetPlatformIdentifier", expectedTargetPlatformIdentifier);
+ assertValue("TargetPlatformIdentifier", expectedTargetPlatformIdentifier);
+ assertValue("TargetPlatformVersion", expectedTargetPlatformVersion);
+ assertValue("TargetPlatformMoniker", $"{expectedTargetPlatformIdentifier},Version={expectedTargetPlatformVersion}");
+ assertValue("TargetPlatformDisplayName", $"{expectedTargetPlatformIdentifier} {expectedTargetPlatformVersion}");
+ }
+
+ [Fact]
+ public void It_fails_on_unsupported_os()
+ {
+ TestProject testProject = new TestProject()
+ {
+ Name = "UnsupportedOS",
+ IsSdkProject = true,
+ TargetFrameworks = "net5.0-unsupported"
+ };
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+
+ var build = new BuildCommand(Log, Path.Combine(testAsset.Path, testProject.Name));
+ build.Execute()
+ .Should()
+ .Fail()
+ .And
+ .HaveStdOutContaining("NETSDK1136");
+ }
+ }
+}
diff --git a/src/Tests/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackACppCliProject.cs b/src/Tests/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackACppCliProject.cs
index fc00b8fed015..e2b51d416a60 100644
--- a/src/Tests/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackACppCliProject.cs
+++ b/src/Tests/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackACppCliProject.cs
@@ -18,7 +18,7 @@ public GivenThatWeWantToPackACppCliProject(ITestOutputHelper log) : base(log)
{
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void It_cannot_pack_the_cppcliproject()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishACppCliAppProject.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishACppCliAppProject.cs
index b07f2c31d214..848c8400622f 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishACppCliAppProject.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishACppCliAppProject.cs
@@ -18,7 +18,7 @@ public GivenThatWeWantToPublishACppCliAppProject(ITestOutputHelper log) : base(l
{
}
- [FullMSBuildOnlyFact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void It_should_fail_with_error_message()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/dotnet-list-package.Tests/GivenDotnetListPackage.cs b/src/Tests/dotnet-list-package.Tests/GivenDotnetListPackage.cs
index 5f7228424773..7daaa66ae9f1 100644
--- a/src/Tests/dotnet-list-package.Tests/GivenDotnetListPackage.cs
+++ b/src/Tests/dotnet-list-package.Tests/GivenDotnetListPackage.cs
@@ -225,7 +225,7 @@ public void ItDoesNotAcceptInvalidFramework()
.Fail();
}
- [Fact]
+ [FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/12560")]
public void ItListsFSharpProject()
{
var testAssetName = "FSharpTestAppSimple";