From 84498ea92d9f73c1ad4cd4a2ad07c64c3f1d1a29 Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Wed, 22 Sep 2021 11:59:54 +0200 Subject: [PATCH 1/8] Clean up minimum Windows version checks --- src/MSBuild/Resources/Strings.resx | 2 +- src/MSBuild/Resources/xlf/Strings.cs.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.de.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.es.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.fr.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.it.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.ja.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.ko.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.pl.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.pt-BR.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.ru.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.tr.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf | 4 +-- src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf | 4 +-- src/MSBuild/XMake.cs | 7 ++--- src/Shared/EncodingUtilities.cs | 10 ------ src/Shared/NativeMethodsShared.cs | 31 ++----------------- src/Tasks/FileState.cs | 4 +-- 18 files changed, 34 insertions(+), 72 deletions(-) diff --git a/src/MSBuild/Resources/Strings.resx b/src/MSBuild/Resources/Strings.resx index 0d8f59307c4..ffc10ca5970 100644 --- a/src/MSBuild/Resources/Strings.resx +++ b/src/MSBuild/Resources/Strings.resx @@ -1092,7 +1092,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.cs.xlf b/src/MSBuild/Resources/xlf/Strings.cs.xlf index 5769d82fa59..08d0d9001c7 100644 --- a/src/MSBuild/Resources/xlf/Strings.cs.xlf +++ b/src/MSBuild/Resources/xlf/Strings.cs.xlf @@ -1330,8 +1330,8 @@ Copyright (C) Microsoft Corporation. Všechna práva vyhrazena. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild nejde spustit v této verzi operačního systému. Podporuje se jenom v systémech Windows 2000, Windows XP a novějších verzích. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild nejde spustit v této verzi operačního systému. Podporuje se jenom v systémech Windows 2000, Windows XP a novějších verzích. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.de.xlf b/src/MSBuild/Resources/xlf/Strings.de.xlf index 9ccad6d1801..78bdf14ecc1 100644 --- a/src/MSBuild/Resources/xlf/Strings.de.xlf +++ b/src/MSBuild/Resources/xlf/Strings.de.xlf @@ -1322,8 +1322,8 @@ Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild kann unter dieser Version des Betriebssystems nicht ausgeführt werden. Nur Windows 2000, Windows XP und Folgeversionen werden unterstützt. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild kann unter dieser Version des Betriebssystems nicht ausgeführt werden. Nur Windows 2000, Windows XP und Folgeversionen werden unterstützt. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.es.xlf b/src/MSBuild/Resources/xlf/Strings.es.xlf index e36eec845fb..6828259158d 100644 --- a/src/MSBuild/Resources/xlf/Strings.es.xlf +++ b/src/MSBuild/Resources/xlf/Strings.es.xlf @@ -1331,8 +1331,8 @@ Copyright (C) Microsoft Corporation. Todos los derechos reservados. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild no se puede ejecutar en esta versión del sistema operativo. Solo es compatible con Windows 2000, Windows XP y versiones posteriores. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild no se puede ejecutar en esta versión del sistema operativo. Solo es compatible con Windows 2000, Windows XP y versiones posteriores. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.fr.xlf b/src/MSBuild/Resources/xlf/Strings.fr.xlf index ecd04ae29ab..ef5cd82885c 100644 --- a/src/MSBuild/Resources/xlf/Strings.fr.xlf +++ b/src/MSBuild/Resources/xlf/Strings.fr.xlf @@ -1322,8 +1322,8 @@ Copyright (C) Microsoft Corporation. Tous droits réservés. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild ne s'exécute pas sur cette version du système d'exploitation. Il est pris en charge uniquement sur Windows 2000, Windows XP et les versions ultérieures. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild ne s'exécute pas sur cette version du système d'exploitation. Il est pris en charge uniquement sur Windows 2000, Windows XP et les versions ultérieures. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.it.xlf b/src/MSBuild/Resources/xlf/Strings.it.xlf index c37e60c4dc4..62c50b55560 100644 --- a/src/MSBuild/Resources/xlf/Strings.it.xlf +++ b/src/MSBuild/Resources/xlf/Strings.it.xlf @@ -1344,8 +1344,8 @@ Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild non può essere eseguito su questa versione del sistema operativo. È supportato solo in Windows 2000, Windows XP e versioni successive. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild non può essere eseguito su questa versione del sistema operativo. È supportato solo in Windows 2000, Windows XP e versioni successive. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.ja.xlf b/src/MSBuild/Resources/xlf/Strings.ja.xlf index 58adc2124db..17313656f04 100644 --- a/src/MSBuild/Resources/xlf/Strings.ja.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ja.xlf @@ -1322,8 +1322,8 @@ Copyright (C) Microsoft Corporation.All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild はこのバージョンのオペレーティング システムでは実行できません。Windows 2000、Windows XP およびそれ以降のバージョンでのみサポートされています。 + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild はこのバージョンのオペレーティング システムでは実行できません。Windows 2000、Windows XP およびそれ以降のバージョンでのみサポートされています。 {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.ko.xlf b/src/MSBuild/Resources/xlf/Strings.ko.xlf index 4e641e8d1e0..296f5321c0d 100644 --- a/src/MSBuild/Resources/xlf/Strings.ko.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ko.xlf @@ -1322,8 +1322,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: 이 운영 체제 버전에서는 MSBuild를 실행할 수 없습니다. MSBuild는 Windows 2000 및 Windows XP 이상 버전에서만 지원됩니다. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: 이 운영 체제 버전에서는 MSBuild를 실행할 수 없습니다. MSBuild는 Windows 2000 및 Windows XP 이상 버전에서만 지원됩니다. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.pl.xlf b/src/MSBuild/Resources/xlf/Strings.pl.xlf index 548f0673c44..c4806d9c2ed 100644 --- a/src/MSBuild/Resources/xlf/Strings.pl.xlf +++ b/src/MSBuild/Resources/xlf/Strings.pl.xlf @@ -1336,8 +1336,8 @@ Copyright (C) Microsoft Corporation. Wszelkie prawa zastrzeżone. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: Program MSBuild nie działa w tej wersji systemu operacyjnego. Jest obsługiwany tylko w systemie Windows 2000, Windows XP oraz nowszych wersjach. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: Program MSBuild nie działa w tej wersji systemu operacyjnego. Jest obsługiwany tylko w systemie Windows 2000, Windows XP oraz nowszych wersjach. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf index e41b484c1a6..066f7604016 100644 --- a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf +++ b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf @@ -1323,8 +1323,8 @@ isoladamente. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: O MSBuild não é executado nesta versão de sistema operacional. Há suporte para ele somente nas versões Windows 2000, Windows XP e versões posteriores. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: O MSBuild não é executado nesta versão de sistema operacional. Há suporte para ele somente nas versões Windows 2000, Windows XP e versões posteriores. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.ru.xlf b/src/MSBuild/Resources/xlf/Strings.ru.xlf index 4ef8b52a05a..2709d31c8fb 100644 --- a/src/MSBuild/Resources/xlf/Strings.ru.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ru.xlf @@ -1321,8 +1321,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild не работает в этой версии операционной системы. Он поддерживается только в Windows 2000, Windows XP и более поздних версиях. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild не работает в этой версии операционной системы. Он поддерживается только в Windows 2000, Windows XP и более поздних версиях. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.tr.xlf b/src/MSBuild/Resources/xlf/Strings.tr.xlf index 8bed4f53eff..b12f9207ca8 100644 --- a/src/MSBuild/Resources/xlf/Strings.tr.xlf +++ b/src/MSBuild/Resources/xlf/Strings.tr.xlf @@ -1326,8 +1326,8 @@ Telif Hakkı (C) Microsoft Corporation. Tüm hakları saklıdır. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild işletim sisteminin bu sürümünde çalışmaz. Yalnızca Windows 2000, Windows XP ve sonraki sürümlerde desteklenir. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild işletim sisteminin bu sürümünde çalışmaz. Yalnızca Windows 2000, Windows XP ve sonraki sürümlerde desteklenir. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf index 011389fa1a6..0250fc82213 100644 --- a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf @@ -1322,8 +1322,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild 不能在此版本的操作系统上运行。它仅在 Windows 2000、Windows XP 及更高版本的操作系统上受支持。 + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild 不能在此版本的操作系统上运行。它仅在 Windows 2000、Windows XP 及更高版本的操作系统上受支持。 {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf index a3b1e39cf03..a090579ab2c 100644 --- a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf @@ -1322,8 +1322,8 @@ Copyright (C) Microsoft Corporation. 著作權所有,並保留一切權利。 LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 2000, Windows XP, and later versions. - MSBUILD : error MSB1015: MSBuild 在此版本的作業系統上不會執行。只有在 Windows 2000、Windows XP 及更新版本才受支援。 + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild 在此版本的作業系統上不會執行。只有在 Windows 2000、Windows XP 及更新版本才受支援。 {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 3a62d532f86..62790956790 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -1545,11 +1545,8 @@ private static bool BuildProjectWithOldOM(string projectFile, string[] targets, private static void VerifyThrowSupportedOS() { #if FEATURE_OSVERSION - if ((Environment.OSVersion.Platform == PlatformID.Win32S) || // Win32S - (Environment.OSVersion.Platform == PlatformID.Win32Windows) || // Windows 95, Windows 98, Windows ME - (Environment.OSVersion.Platform == PlatformID.WinCE) || // Windows CE - ((Environment.OSVersion.Platform == PlatformID.Win32NT) && // Windows NT 4.0 and earlier - (Environment.OSVersion.Version.Major <= 4))) + if (Environment.OSVersion.Platform != PlatformID.Win32NT || + Environment.OSVersion.Version.Major < 10) // Windows 10 is minimum { // If we're running on any of the unsupported OS's, fail immediately. This way, // we don't run into some obscure error down the line, totally confusing the user. diff --git a/src/Shared/EncodingUtilities.cs b/src/Shared/EncodingUtilities.cs index 1a74d635c1c..c492d063165 100644 --- a/src/Shared/EncodingUtilities.cs +++ b/src/Shared/EncodingUtilities.cs @@ -219,16 +219,6 @@ internal static Encoding BatchFileEncoding(string contents, string encodingSpeci string useUtf8 = string.IsNullOrEmpty(encodingSpecification) ? EncodingUtilities.UseUtf8Detect : encodingSpecification; -#if FEATURE_OSVERSION - // UTF8 is only supported in Windows 7 (6.1) or greater. - var windows7 = new Version(6, 1); - - if (Environment.OSVersion.Version < windows7) - { - useUtf8 = EncodingUtilities.UseUtf8Never; - } -#endif - switch (useUtf8.ToUpperInvariant()) { case EncodingUtilities.UseUtf8Always: diff --git a/src/Shared/NativeMethodsShared.cs b/src/Shared/NativeMethodsShared.cs index 09314174d36..810125d90ac 100644 --- a/src/Shared/NativeMethodsShared.cs +++ b/src/Shared/NativeMethodsShared.cs @@ -876,33 +876,6 @@ private static SystemInformationData SystemInformation #endregion -#region Set Error Mode (copied from BCL) - - private static readonly Version s_threadErrorModeMinOsVersion = new Version(6, 1, 0x1db0); - - internal static int SetErrorMode(int newMode) - { -#if FEATURE_OSVERSION - if (Environment.OSVersion.Version < s_threadErrorModeMinOsVersion) - { - return SetErrorMode_VistaAndOlder(newMode); - } -#endif - int num; - SetErrorMode_Win7AndNewer(newMode, out num); - return num; - } - - [SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass", Justification = "Class name is NativeMethodsShared for increased clarity")] - [DllImport("kernel32.dll", EntryPoint = "SetThreadErrorMode", SetLastError = true)] - private static extern bool SetErrorMode_Win7AndNewer(int newMode, out int oldMode); - - [SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass", Justification = "Class name is NativeMethodsShared for increased clarity")] - [DllImport("kernel32.dll", EntryPoint = "SetErrorMode", ExactSpelling = true)] - private static extern int SetErrorMode_VistaAndOlder(int newMode); - -#endregion - #region Wrapper methods /// @@ -1636,9 +1609,11 @@ out FILETIME lpLastWriteTime [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CloseHandle(IntPtr hObject); + [DllImport("kernel32.dll", SetLastError = true)] + internal static extern bool SetThreadErrorMode(int newMode, out int oldMode); + #endregion #region Extensions diff --git a/src/Tasks/FileState.cs b/src/Tasks/FileState.cs index 6545558ff30..af2e2f29897 100644 --- a/src/Tasks/FileState.cs +++ b/src/Tasks/FileState.cs @@ -93,7 +93,7 @@ public FileDirInfo(string filename) // there is no disk in drive A:, please insert one. We don't want that. // SetErrorMode will let us disable this, but we should set the error // mode back, since this may have wide-ranging effects. - oldMode = NativeMethodsShared.SetErrorMode(1 /* ErrorModes.SEM_FAILCRITICALERRORS */); + NativeMethodsShared.SetThreadErrorMode(1 /* ErrorModes.SEM_FAILCRITICALERRORS */, out oldMode); } try @@ -174,7 +174,7 @@ public FileDirInfo(string filename) // Reset the error mode on Windows if (NativeMethodsShared.IsWindows) { - NativeMethodsShared.SetErrorMode(oldMode); + NativeMethodsShared.SetThreadErrorMode(oldMode, out _); } } } From 5d6c1e8346ec5f342b72f455a5feb06391c0de3e Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Wed, 22 Sep 2021 14:11:04 +0200 Subject: [PATCH 2/8] [Debug] Check which OS is used by the pipeline --- src/MSBuild/XMake.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 62790956790..505c4a46899 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -1550,7 +1550,8 @@ private static void VerifyThrowSupportedOS() { // If we're running on any of the unsupported OS's, fail immediately. This way, // we don't run into some obscure error down the line, totally confusing the user. - InitializationException.VerifyThrow(false, "UnsupportedOS"); + InitializationException.Throw($"Platform {Environment.OSVersion.Platform}, version {Environment.OSVersion.Version}", ""); + //InitializationException.VerifyThrow(false, "UnsupportedOS"); } #endif } From afa86d40cd42f497337792ffe488ce1a54cfb490 Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Wed, 22 Sep 2021 16:16:33 +0200 Subject: [PATCH 3/8] Revert "[Debug] Check which OS is used by the pipeline" This reverts commit 5d6c1e8346ec5f342b72f455a5feb06391c0de3e. --- src/MSBuild/XMake.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 505c4a46899..62790956790 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -1550,8 +1550,7 @@ private static void VerifyThrowSupportedOS() { // If we're running on any of the unsupported OS's, fail immediately. This way, // we don't run into some obscure error down the line, totally confusing the user. - InitializationException.Throw($"Platform {Environment.OSVersion.Platform}, version {Environment.OSVersion.Version}", ""); - //InitializationException.VerifyThrow(false, "UnsupportedOS"); + InitializationException.VerifyThrow(false, "UnsupportedOS"); } #endif } From 260639964a49bffe40233fc1b4cde76a8cae6be4 Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Wed, 22 Sep 2021 16:17:39 +0200 Subject: [PATCH 4/8] Guard against non-manifested host .exe's --- src/MSBuild/XMake.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 62790956790..c96b6a2a009 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -89,6 +89,11 @@ public enum ExitType ProjectCacheFailure } + /// + /// True if the Main method was invoked. False indicates that we're running hosted in another process (e.g. unit tests). + /// + private static bool s_executingMainEntryPoint; + /// /// Whether the static constructor ran successfully. /// @@ -214,6 +219,8 @@ string [] args #endif ) { + s_executingMainEntryPoint = true; + using PerformanceLogEventListener eventListener = PerformanceLogEventListener.Create(); if (Environment.GetEnvironmentVariable("MSBUILDDUMPPROCESSCOUNTERS") == "1") @@ -1545,8 +1552,14 @@ private static bool BuildProjectWithOldOM(string projectFile, string[] targets, private static void VerifyThrowSupportedOS() { #if FEATURE_OSVERSION + // We require Windows 10 but the OS may lie about the version if the .exe is not properly manifested + // (such as e.g. the unit test console runner). + var minimumVersion = s_executingMainEntryPoint + ? new Version(10, 0) // Windows 10 + : new Version(6, 2); // Windows 10 pretending to be Windows 8 + if (Environment.OSVersion.Platform != PlatformID.Win32NT || - Environment.OSVersion.Version.Major < 10) // Windows 10 is minimum + Environment.OSVersion.Version < minimumVersion) { // If we're running on any of the unsupported OS's, fail immediately. This way, // we don't run into some obscure error down the line, totally confusing the user. From 726a8585081c957c1f6a07e4651c791658284f8e Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Wed, 22 Sep 2021 16:29:45 +0200 Subject: [PATCH 5/8] Set s_executingMainEntryPoint only if FEATURE_OSVERSION is defined --- src/MSBuild/XMake.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index c96b6a2a009..5fe5cfd1796 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -89,10 +89,12 @@ public enum ExitType ProjectCacheFailure } +#if FEATURE_OSVERSION /// /// True if the Main method was invoked. False indicates that we're running hosted in another process (e.g. unit tests). /// private static bool s_executingMainEntryPoint; +#endif /// /// Whether the static constructor ran successfully. @@ -219,7 +221,9 @@ string [] args #endif ) { +#if FEATURE_OSVERSION s_executingMainEntryPoint = true; +#endif using PerformanceLogEventListener eventListener = PerformanceLogEventListener.Create(); From b4520c08278d31e19d3a994224f3d81b83b676d1 Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Fri, 1 Oct 2021 08:12:06 +0200 Subject: [PATCH 6/8] Revert "Set s_executingMainEntryPoint only if FEATURE_OSVERSION is defined" This reverts commit 726a8585081c957c1f6a07e4651c791658284f8e. --- src/MSBuild/XMake.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 5fe5cfd1796..c96b6a2a009 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -89,12 +89,10 @@ public enum ExitType ProjectCacheFailure } -#if FEATURE_OSVERSION /// /// True if the Main method was invoked. False indicates that we're running hosted in another process (e.g. unit tests). /// private static bool s_executingMainEntryPoint; -#endif /// /// Whether the static constructor ran successfully. @@ -221,9 +219,7 @@ string [] args #endif ) { -#if FEATURE_OSVERSION s_executingMainEntryPoint = true; -#endif using PerformanceLogEventListener eventListener = PerformanceLogEventListener.Create(); From 32cfb7fab9af8c85200ec04dbc56c3671603e80b Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Fri, 1 Oct 2021 08:12:20 +0200 Subject: [PATCH 7/8] Revert "Guard against non-manifested host .exe's" This reverts commit 260639964a49bffe40233fc1b4cde76a8cae6be4. --- src/MSBuild/XMake.cs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index c96b6a2a009..62790956790 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -89,11 +89,6 @@ public enum ExitType ProjectCacheFailure } - /// - /// True if the Main method was invoked. False indicates that we're running hosted in another process (e.g. unit tests). - /// - private static bool s_executingMainEntryPoint; - /// /// Whether the static constructor ran successfully. /// @@ -219,8 +214,6 @@ string [] args #endif ) { - s_executingMainEntryPoint = true; - using PerformanceLogEventListener eventListener = PerformanceLogEventListener.Create(); if (Environment.GetEnvironmentVariable("MSBUILDDUMPPROCESSCOUNTERS") == "1") @@ -1552,14 +1545,8 @@ private static bool BuildProjectWithOldOM(string projectFile, string[] targets, private static void VerifyThrowSupportedOS() { #if FEATURE_OSVERSION - // We require Windows 10 but the OS may lie about the version if the .exe is not properly manifested - // (such as e.g. the unit test console runner). - var minimumVersion = s_executingMainEntryPoint - ? new Version(10, 0) // Windows 10 - : new Version(6, 2); // Windows 10 pretending to be Windows 8 - if (Environment.OSVersion.Platform != PlatformID.Win32NT || - Environment.OSVersion.Version < minimumVersion) + Environment.OSVersion.Version.Major < 10) // Windows 10 is minimum { // If we're running on any of the unsupported OS's, fail immediately. This way, // we don't run into some obscure error down the line, totally confusing the user. From a6271b5a237809246ca7ac989d9540f19b4ddd67 Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Fri, 1 Oct 2021 08:28:14 +0200 Subject: [PATCH 8/8] Make Win7 the minimum version for Framework --- src/MSBuild/Resources/Strings.resx | 2 +- src/MSBuild/Resources/xlf/Strings.cs.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.de.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.es.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.fr.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.it.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.ja.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.ko.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.pl.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.pt-BR.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.ru.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.tr.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf | 2 +- src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf | 2 +- src/MSBuild/XMake.cs | 3 ++- 15 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/MSBuild/Resources/Strings.resx b/src/MSBuild/Resources/Strings.resx index ffc10ca5970..61b9471ba63 100644 --- a/src/MSBuild/Resources/Strings.resx +++ b/src/MSBuild/Resources/Strings.resx @@ -1092,7 +1092,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.cs.xlf b/src/MSBuild/Resources/xlf/Strings.cs.xlf index 08d0d9001c7..683606d4fa8 100644 --- a/src/MSBuild/Resources/xlf/Strings.cs.xlf +++ b/src/MSBuild/Resources/xlf/Strings.cs.xlf @@ -1330,7 +1330,7 @@ Copyright (C) Microsoft Corporation. Všechna práva vyhrazena. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild nejde spustit v této verzi operačního systému. Podporuje se jenom v systémech Windows 2000, Windows XP a novějších verzích. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.de.xlf b/src/MSBuild/Resources/xlf/Strings.de.xlf index 78bdf14ecc1..a6d4afe3c64 100644 --- a/src/MSBuild/Resources/xlf/Strings.de.xlf +++ b/src/MSBuild/Resources/xlf/Strings.de.xlf @@ -1322,7 +1322,7 @@ Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild kann unter dieser Version des Betriebssystems nicht ausgeführt werden. Nur Windows 2000, Windows XP und Folgeversionen werden unterstützt. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.es.xlf b/src/MSBuild/Resources/xlf/Strings.es.xlf index 6828259158d..e284447ae5d 100644 --- a/src/MSBuild/Resources/xlf/Strings.es.xlf +++ b/src/MSBuild/Resources/xlf/Strings.es.xlf @@ -1331,7 +1331,7 @@ Copyright (C) Microsoft Corporation. Todos los derechos reservados. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild no se puede ejecutar en esta versión del sistema operativo. Solo es compatible con Windows 2000, Windows XP y versiones posteriores. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.fr.xlf b/src/MSBuild/Resources/xlf/Strings.fr.xlf index ef5cd82885c..1f465b9f5fa 100644 --- a/src/MSBuild/Resources/xlf/Strings.fr.xlf +++ b/src/MSBuild/Resources/xlf/Strings.fr.xlf @@ -1322,7 +1322,7 @@ Copyright (C) Microsoft Corporation. Tous droits réservés. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild ne s'exécute pas sur cette version du système d'exploitation. Il est pris en charge uniquement sur Windows 2000, Windows XP et les versions ultérieures. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.it.xlf b/src/MSBuild/Resources/xlf/Strings.it.xlf index 62c50b55560..17f8ef60d33 100644 --- a/src/MSBuild/Resources/xlf/Strings.it.xlf +++ b/src/MSBuild/Resources/xlf/Strings.it.xlf @@ -1344,7 +1344,7 @@ Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild non può essere eseguito su questa versione del sistema operativo. È supportato solo in Windows 2000, Windows XP e versioni successive. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.ja.xlf b/src/MSBuild/Resources/xlf/Strings.ja.xlf index 17313656f04..6c17289c3c1 100644 --- a/src/MSBuild/Resources/xlf/Strings.ja.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ja.xlf @@ -1322,7 +1322,7 @@ Copyright (C) Microsoft Corporation.All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild はこのバージョンのオペレーティング システムでは実行できません。Windows 2000、Windows XP およびそれ以降のバージョンでのみサポートされています。 {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.ko.xlf b/src/MSBuild/Resources/xlf/Strings.ko.xlf index 296f5321c0d..aaa3d3ec15c 100644 --- a/src/MSBuild/Resources/xlf/Strings.ko.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ko.xlf @@ -1322,7 +1322,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: 이 운영 체제 버전에서는 MSBuild를 실행할 수 없습니다. MSBuild는 Windows 2000 및 Windows XP 이상 버전에서만 지원됩니다. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.pl.xlf b/src/MSBuild/Resources/xlf/Strings.pl.xlf index c4806d9c2ed..bf6053ea021 100644 --- a/src/MSBuild/Resources/xlf/Strings.pl.xlf +++ b/src/MSBuild/Resources/xlf/Strings.pl.xlf @@ -1336,7 +1336,7 @@ Copyright (C) Microsoft Corporation. Wszelkie prawa zastrzeżone. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: Program MSBuild nie działa w tej wersji systemu operacyjnego. Jest obsługiwany tylko w systemie Windows 2000, Windows XP oraz nowszych wersjach. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf index 066f7604016..ed957260598 100644 --- a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf +++ b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf @@ -1323,7 +1323,7 @@ isoladamente. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: O MSBuild não é executado nesta versão de sistema operacional. Há suporte para ele somente nas versões Windows 2000, Windows XP e versões posteriores. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.ru.xlf b/src/MSBuild/Resources/xlf/Strings.ru.xlf index 2709d31c8fb..a16f15e95bc 100644 --- a/src/MSBuild/Resources/xlf/Strings.ru.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ru.xlf @@ -1321,7 +1321,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild не работает в этой версии операционной системы. Он поддерживается только в Windows 2000, Windows XP и более поздних версиях. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.tr.xlf b/src/MSBuild/Resources/xlf/Strings.tr.xlf index b12f9207ca8..6de7f438111 100644 --- a/src/MSBuild/Resources/xlf/Strings.tr.xlf +++ b/src/MSBuild/Resources/xlf/Strings.tr.xlf @@ -1326,7 +1326,7 @@ Telif Hakkı (C) Microsoft Corporation. Tüm hakları saklıdır. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild işletim sisteminin bu sürümünde çalışmaz. Yalnızca Windows 2000, Windows XP ve sonraki sürümlerde desteklenir. {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf index 0250fc82213..d29ed7c8e4b 100644 --- a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf @@ -1322,7 +1322,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild 不能在此版本的操作系统上运行。它仅在 Windows 2000、Windows XP 及更高版本的操作系统上受支持。 {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf index a090579ab2c..95fe02eeca4 100644 --- a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf @@ -1322,7 +1322,7 @@ Copyright (C) Microsoft Corporation. 著作權所有,並保留一切權利。 LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized. - MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 10 and later versions. + MSBUILD : error MSB1015: MSBuild does not run on this version of the operating system. It is only supported on Windows 7 and later versions. MSBUILD : error MSB1015: MSBuild 在此版本的作業系統上不會執行。只有在 Windows 2000、Windows XP 及更新版本才受支援。 {StrBegin="MSBUILD : error MSB1015: "}LOCALIZATION: The error prefix "MSBUILD : error MSBxxxx:" should not be localized. diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 62790956790..b3cf4561a15 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -1546,7 +1546,8 @@ private static void VerifyThrowSupportedOS() { #if FEATURE_OSVERSION if (Environment.OSVersion.Platform != PlatformID.Win32NT || - Environment.OSVersion.Version.Major < 10) // Windows 10 is minimum + Environment.OSVersion.Version.Major < 6 || + (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor < 1)) // Windows 7 is minimum { // If we're running on any of the unsupported OS's, fail immediately. This way, // we don't run into some obscure error down the line, totally confusing the user.