diff --git a/src/MSBuild/Resources/Strings.resx b/src/MSBuild/Resources/Strings.resx
index 0d8f59307c4..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 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 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 5769d82fa59..683606d4fa8 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 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 9ccad6d1801..a6d4afe3c64 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 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 e36eec845fb..e284447ae5d 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 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 ecd04ae29ab..1f465b9f5fa 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 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 c37e60c4dc4..17f8ef60d33 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 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 58adc2124db..6c17289c3c1 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 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 4e641e8d1e0..aaa3d3ec15c 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 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 548f0673c44..bf6053ea021 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 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 e41b484c1a6..ed957260598 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 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 4ef8b52a05a..a16f15e95bc 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 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 8bed4f53eff..6de7f438111 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 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 011389fa1a6..d29ed7c8e4b 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 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 a3b1e39cf03..95fe02eeca4 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 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 3a62d532f86..b3cf4561a15 100644
--- a/src/MSBuild/XMake.cs
+++ b/src/MSBuild/XMake.cs
@@ -1545,11 +1545,9 @@ 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 < 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.
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 _);
}
}
}