771 references to NativeMethods
Microsoft.Build (88)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
BackEnd\BuildManager\BuildManager.cs (9)
506if (NativeMethodsShared.IsWindows || parameters.LowPriority) 795ErrorUtilities.VerifyThrowInvalidOperation(NativeMethodsShared.ProcessorArchitecture == NativeMethodsShared.ProcessorArchitectures.X64, "ReportFileAccessesX64Only"); 1145_buildTelemetry.BuildEngineFrameworkName = NativeMethodsShared.FrameworkName; 1159var sacState = NativeMethodsShared.GetSACState(); 1161_buildTelemetry.SACEnabled = sacState == NativeMethodsShared.SAC_State.Evaluation || sacState == NativeMethodsShared.SAC_State.Enforcement; 1251NativeMethodsShared.FrameworkName, 1273BuildEngineFrameworkName = NativeMethodsShared.FrameworkName,
BackEnd\BuildManager\BuildParameters.cs (1)
65private static string s_startupDirectory = NativeMethodsShared.GetCurrentDirectory();
BackEnd\Client\MSBuildClient.cs (2)
217NativeMethodsShared.RestoreConsoleMode(_originalConsoleMode); 361(var acceptAnsiColorCodes, var outputIsScreen, _originalConsoleMode) = NativeMethodsShared.QueryIsScreenAndTryEnableAnsiColorCodes();
BackEnd\Components\BuildRequestEngine\BuildRequestEngine.cs (4)
888if (!NativeMethodsShared.IsWindows || BuildEnvironmentHelper.Instance.RunningInVisualStudio) 904NativeMethodsShared.MemoryStatus memoryStatus = NativeMethodsShared.GetMemoryStatus(); 939memoryStatus = NativeMethodsShared.GetMemoryStatus();
BackEnd\Components\Caching\ResultsCache.cs (1)
252capacity => new ConcurrentDictionary<int, BuildResult>(NativeMethodsShared.GetLogicalCoreCount(), capacity));
BackEnd\Components\Communications\DetouredNodeLauncher.cs (1)
114new BreakawayChildProcess(NativeMethodsShared.IsWindows ? "VBCSCompiler.exe" : "VBCSCompiler")
BackEnd\Components\Communications\NodeLauncher.cs (3)
65return NativeMethodsShared.IsWindows 232NativeMethodsShared.CloseHandle(processInfo.hProcess); 237NativeMethodsShared.CloseHandle(processInfo.hThread);
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (2)
641return Math.Max(1, (3 * NativeMethodsShared.GetLogicalCoreCount()) / 2); 815if (NativeMethodsShared.IsWindows)
BackEnd\Components\Communications\RarNodeLauncher.cs (1)
56if (NativeMethodsShared.IsWindows)
BackEnd\Components\RequestBuilder\TargetUpToDateChecker.cs (5)
988oldestOutputFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(oldestOutputFullPath); 1013candidateOutputFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(candidateOutputFullPath); 1048inputFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(unescapedInputFullPath); 1203var path1WriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path1); 1206var path2WriteTime = NativeMethodsShared.GetLastWriteFileUtcTime(path2);
BackEnd\Components\Scheduler\Scheduler.cs (1)
243_coreLimit = NativeMethodsShared.GetLogicalCoreCount();
BackEnd\Components\SdkResolution\SdkResolverService.cs (1)
547NativeMethodsShared.GetLogicalCoreCount(),
BackEnd\Node\InProcNode.cs (3)
148_savedCurrentDirectory = NativeMethodsShared.GetCurrentDirectory(); 351NativeMethodsShared.SetCurrentDirectory(_savedCurrentDirectory); 487_savedCurrentDirectory = NativeMethodsShared.GetCurrentDirectory();
BackEnd\Node\OutOfProcNode.cs (4)
495NativeMethodsShared.SetCurrentDirectory(BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory); 722NativeMethodsShared.SetCurrentDirectory(BuildParameters.StartupDirectory); 727NativeMethodsShared.SetCurrentDirectory(BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory); 884if (!lowPriority || NativeMethodsShared.IsWindows)
BackEnd\Node\OutOfProcServerNode.cs (3)
255NativeMethodsShared.SetCurrentDirectory(BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory); 409if (NativeMethodsShared.IsWindows && command.ConsoleConfiguration.BufferWidth > 0) 444NativeMethodsShared.SetCurrentDirectory(BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory);
BackEnd\Shared\BuildRequestConfiguration.cs (2)
455NativeMethodsShared.SetCurrentDirectory(BuildParameters.StartupDirectory); 460NativeMethodsShared.SetCurrentDirectory(
CommunicationsUtilities.cs (1)
287if (includeSessionId && NativeMethodsShared.IsWindows)
Construction\ProjectRootElement.cs (3)
179_directory = NativeMethodsShared.GetCurrentDirectory(); 204_directory = NativeMethodsShared.GetCurrentDirectory(); 261_directory = NativeMethodsShared.GetCurrentDirectory();
Definition\ToolsetReader.cs (3)
149if (NativeMethodsShared.IsWindows || registryReader != null) 167var libraryPath = NativeMethodsShared.FrameworkBasePath; 493var importSearchPathsTable = GetProjectImportSearchPathsTable(toolsVersion.Name, NativeMethodsShared.GetOSNameForExtensionsPath());
Evaluation\Evaluator.cs (3)
1159if (!NativeMethodsShared.IsWindows) 1161SetBuiltInProperty(ReservedPropertyNames.osName, NativeMethodsShared.OSName); 1162SetBuiltInProperty(ReservedPropertyNames.frameworkToolsRoot, NativeMethodsShared.FrameworkBasePath);
Evaluation\Expander.cs (2)
1786if (!NativeMethodsShared.IsWindows && !registryKeyName.StartsWith("HKEY_CURRENT_USER", StringComparison.OrdinalIgnoreCase)) 1796return NativeMethodsShared.FrameworkBasePath + Path.DirectorySeparatorChar;
Evaluation\IntrinsicFunctions.cs (4)
288if (!NativeMethodsShared.IsWindows && !keyName.StartsWith("HKEY_CURRENT_USER", StringComparison.OrdinalIgnoreCase)) 297return Path.Combine(NativeMethodsShared.FrameworkBasePath, m.Groups[0].Value) + Path.DirectorySeparatorChar; 588return NativeMethodsShared.IsUnixLike; 597return NativeMethodsShared.IsBSD;
Graph\ProjectGraph.cs (2)
341NativeMethodsShared.GetLogicalCoreCount(), 382NativeMethodsShared.GetLogicalCoreCount(),
Instance\HostServices.cs (1)
89if (NativeMethodsShared.IsWindows)
Instance\RunningObjectTable.cs (2)
27if (!NativeMethodsShared.IsWindows) 95if (NativeMethodsShared.IsWindows && Ole32.GetErrorInfo(0, out IErrorInfo errorInfo) == 0 && errorInfo != null)
Logging\BaseConsoleLogger.cs (1)
265runningWithCharacterFileType = NativeMethodsShared.IsWindows && ConsoleConfiguration.OutputIsScreen;
Logging\InProcessConsoleConfiguration.cs (10)
27if (NativeMethodsShared.IsWindows && !Console.IsOutputRedirected) 31IntPtr stdOut = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); 32if (NativeMethodsShared.GetConsoleMode(stdOut, out uint consoleMode)) 34acceptAnsiColorCodes = (consoleMode & NativeMethodsShared.ENABLE_VIRTUAL_TERMINAL_PROCESSING) != 0; 78if (NativeMethodsShared.IsWindows) 81IntPtr stdHandle = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); 85uint fileType = NativeMethodsShared.GetFileType(stdHandle); 88isScreen = fileType == NativeMethodsShared.FILE_TYPE_CHAR;
Logging\SimpleErrorLogger.cs (4)
27(acceptAnsiColorCodes, _, originalConsoleMode) = NativeMethods.QueryIsScreenAndTryEnableAnsiColorCodes(NativeMethods.StreamHandleType.StdErr); 88NativeMethods.RestoreConsoleMode(originalConsoleMode, NativeMethods.StreamHandleType.StdErr);
Logging\TerminalLogger\TerminalLogger.cs (5)
265(bool supportsAnsi, bool outputIsScreen, uint? originalConsoleMode) = NativeMethodsShared.QueryIsScreenAndTryEnableAnsiColorCodes(); 277(bool supportsAnsi, bool outputIsScreen, uint? originalConsoleMode) = NativeMethodsShared.QueryIsScreenAndTryEnableAnsiColorCodes(); 367NativeMethodsShared.RestoreConsoleMode(originalConsoleMode); 381NativeMethodsShared.RestoreConsoleMode(originalConsoleMode); 547NativeMethodsShared.RestoreConsoleMode(_originalConsoleMode);
NamedPipeUtil.cs (1)
26if (NativeMethodsShared.IsUnixLike)
Utilities\Utilities.cs (2)
502string extensionsPath32 = NativeMethodsShared.IsWindows 518string extensionsPath64 = NativeMethodsShared.IsWindows
Microsoft.Build.BuildCheck.UnitTests (8)
DoubleWritesAnalyzer_Tests.cs (1)
28string projectFile = Framework.NativeMethods.IsWindows ? @"C:\fake\project.proj" : "/fake/project.proj";
ExecCliBuildCheck_Tests.cs (1)
94string projectFile = Framework.NativeMethods.IsWindows ? @"C:\fake\project.proj" : "/fake/project.proj";
SharedOutputPathCheck_Tests.cs (6)
41string projectFile1 = Framework.NativeMethods.IsWindows ? "C:\\fake1\\project1.proj" : "/fake1/project1.proj"; 51string projectFile2 = Framework.NativeMethods.IsWindows ? "C:\\fake2\\project2.proj" : "/fake2/project2.proj"; 68string projectFile1 = Framework.NativeMethods.IsWindows ? "C:\\fake\\project1.proj" : "/fake/project1.proj"; 69string projectFile2 = Framework.NativeMethods.IsWindows ? "C:\\fake\\project2.proj" : "/fake/project2.proj"; 93string wrongPathSeparator = Framework.NativeMethods.IsWindows ? "/" : "\\"; 108string projectFolder = Framework.NativeMethods.IsWindows ? "C:\\fake\\" : "/fake/";
Microsoft.Build.CommandLine.UnitTests (13)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
XMake_Tests.cs (12)
139parameters[1].ShouldBe(Convert.ToString(NativeMethodsShared.GetLogicalCoreCount())); 1244NativeMethodsShared.IsWindows ? @"c:\bin\msbuild.exe" : "/msbuild.exe", 1271private readonly string _pathToArbitraryBogusFile = NativeMethodsShared.IsWindows // OK on 64 bit as well 1281var msbuildParameters = "\"" + _pathToArbitraryBogusFile + "\"" + (NativeMethodsShared.IsWindows ? " /v:diag" : " -v:diag"); 1287output.ShouldContain(RunnerUtilities.PathToCurrentlyRunningMsBuildExe + (NativeMethodsShared.IsWindows ? " /v:diag " : " -v:diag ") + _pathToArbitraryBogusFile, Case.Insensitive); 1296var msbuildParameters = "\"" + _pathToArbitraryBogusFile + "\"" + (NativeMethodsShared.IsWindows ? " /v:diag" : " -v:diag"); 1302if (NativeMethodsShared.IsWindows) 1310output.ShouldContain(RunnerUtilities.PathToCurrentlyRunningMsBuildExe + (NativeMethodsShared.IsWindows ? " /v:diag " : " -v:diag ") + _pathToArbitraryBogusFile, Case.Insensitive); 1326var msbuildParameters = "\"" + _pathToArbitraryBogusFile + "\"" + (NativeMethodsShared.IsWindows ? " /v:diag" : " -v:diag"); 1336output.ShouldContain(RunnerUtilities.PathToCurrentlyRunningMsBuildExe + (NativeMethodsShared.IsWindows ? " /v:diag " : " -v:diag ") + _pathToArbitraryBogusFile, Case.Insensitive); 2259fileLoggerParameters = new[] { "Parameter1", "verbosity=Normal;logfile=" + (NativeMethodsShared.IsWindows ? "c:\\temp\\cat.log" : "/tmp/cat.log") }; 3007ProjectCollection.DisplayVersion, NativeMethodsShared.FrameworkName);
Microsoft.Build.Engine.OM.UnitTests (39)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
Construction\ProjectRootElement_Tests.cs (1)
1772Assert.Equal(NativeMethodsShared.GetCurrentDirectory(), rootElement.DirectoryPath);
Construction\SolutionFile_Tests.cs (1)
735return usesNewParser && !NativeMethodsShared.IsWindows ? path.Replace('\\', '/') : path;
Construction\WhiteSpacePreservation_Tests.cs (1)
450if (NativeMethodsShared.IsWindows)
Definition\DefinitionEditing_Tests.cs (9)
329NativeMethodsShared.IsWindows 522NativeMethodsShared.IsWindows ? @"c:\subdir1\**\subdir2\**\*.x?x" : "/subdir1/**/subdir2/**/*.x?x"); 528NativeMethodsShared.IsWindows ? @"c:\subdir1\a\b\subdir2\c\i1.xyx" : "/subdir1/a/b/subdir2/c/i1.xyx")[ 532NativeMethodsShared.IsWindows ? 1522xml.AddImport(NativeMethodsShared.IsWindows ? 2252NativeMethodsShared.IsWindows ? @"c:\" + Guid.NewGuid().ToString() + @"\**\i1" : "/" + Guid.NewGuid().ToString() + "/**/i1"); 2442NativeMethodsShared.IsWindows ? @"c:\subdir1\**\subdir2\**\*.x?x" : "/subdir1/**/subdir2/**/*.x?x"); 2446NativeMethodsShared.IsWindows ? @"c:\subdir1\a\b\subdir2\c\i1.xyx" : "/subdir1/a/b/subdir2/c/i1.xyx")[0].Xml; 2449NativeMethodsShared.IsWindows ?
Definition\Project_Tests.cs (3)
43private readonly int RootPrefixLength = NativeMethodsShared.IsWindows ? 3 : 1; 682if (NativeMethodsShared.IsWindows) 2834var itemElements = NativeMethodsShared.GetLogicalCoreCount() * 5;
Definition\ProjectCollection_Tests.cs (1)
409string projectDirectory = NativeMethodsShared.IsWindows ? "c:\\1" : "/l";
Definition\ProjectItem_Tests.cs (12)
284NativeMethodsShared.IsWindows ? @"<i Include='c:\foo\bar.baz'/>" : @"<i Include='/foo/bar.baz'/>"); 298NativeMethodsShared.IsWindows ? @"c:\foo\bar.baz" : "/foo/bar.baz", 300Assert.Equal(NativeMethodsShared.IsWindows ? @"c:\" : "/", item.GetMetadataValue("RootDir")); 303Assert.Equal(NativeMethodsShared.IsWindows ? @"c:\foo\" : "/foo/", item.GetMetadataValue("RelativeDir")); 304Assert.Equal(NativeMethodsShared.IsWindows ? @"foo\" : "foo/", item.GetMetadataValue("Directory")); 307NativeMethodsShared.IsWindows ? @"c:\foo\bar.baz" : "/foo/bar.baz", 369"<i Include='" + directory + (NativeMethodsShared.IsWindows ? @"\**\*'/>" : "/**/*'/>")); 371Assert.Equal(NativeMethodsShared.IsWindows ? @"b\" : "b/", item.GetMetadataValue("RecursiveDir")); 414IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment("<i Include='i0;" + directory + (NativeMethodsShared.IsWindows ? @"\**\*;i2'/>" : "/**/*;i2'/>")); 418Assert.Equal(NativeMethodsShared.IsWindows ? @"b\" : "b/", items[1].GetMetadataValue("RecursiveDir")); 751if (NativeMethodsShared.IsWindows) 1650<i Include='i1.cpp;" + (NativeMethodsShared.IsWindows ? @"c:\bar\i2.cpp" : "/bar/i2.cpp") + @"'>
Definition\ProjectItemDefinition_Tests.cs (4)
240<i Include='" + (NativeMethodsShared.IsWindows ? @"c:\a\b.ext" : "/a/b.ext") + @"'/> 267<i Include='" + (NativeMethodsShared.IsWindows ? @"c:\a\b.ext" : "/a/b.ext") + @"'/> 294<i Include='" + (NativeMethodsShared.IsWindows ? @"c:\a\b.ext" : "/a/b.ext") + @"'/> 323<i Include='" + (NativeMethodsShared.IsWindows ? @"c:\a\b.ext" : "/a/b.ext") + @"'>
Definition\ProjectProperty_Tests.cs (2)
154string varName = NativeMethodsShared.IsWindows ? "username" : "USER"; 177string varName = NativeMethodsShared.IsWindows ? "username" : "USER";
Instance\ProjectInstance_Tests.cs (3)
893instance.GetProperty(NativeMethodsShared.IsWindows ? "username" : "USER").EvaluatedValue = 918instance.GetProperty(NativeMethodsShared.IsWindows ? "username" : "USER").EvaluatedValue = 940instance.GetProperty(NativeMethodsShared.IsWindows ? "username" : "USER").EvaluatedValue =
Instance\ProjectItemInstance_Tests.cs (1)
751<i Include='i1.cpp;" + (NativeMethodsShared.IsWindows ? @"c:\bar\i2.cpp" : "/bar/i2.cpp") + @"'>
Microsoft.Build.Engine.UnitTests (161)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
BackEnd\AppHostSupport_Tests.cs (1)
27private readonly string _dotnetHostPath = NativeMethodsShared.IsWindows
BackEnd\BuildManager_Tests.cs (2)
290<Exec Command='echo What does a cat say : " + (NativeMethodsShared.IsWindows ? "%MOO%" : "$MOO") + @"' /> 4081MaxNodeCount = NativeMethodsShared.GetLogicalCoreCount(),
BackEnd\BuildRequestConfiguration_Tests.cs (1)
540if (!NativeMethodsShared.IsWindows)
BackEnd\TargetUpToDateChecker_Tests.cs (6)
1042NativeMethodsShared.CreateFile( 1043inputSymlink, NativeMethodsShared.GENERIC_READ | 0x100 /* FILE_WRITE_ATTRIBUTES */, 1044NativeMethodsShared.FILE_SHARE_READ, IntPtr.Zero, NativeMethodsShared.OPEN_EXISTING, 1045NativeMethodsShared.FILE_ATTRIBUTE_NORMAL | NativeMethodsShared.FILE_FLAG_OPEN_REPARSE_POINT,
BinaryLogger_Tests.cs (2)
480Assert.True(NativeMethodsShared.MakeSymbolicLink(symlinkPath, testFile.Path, ref errorMessage), errorMessage); 481Assert.True(NativeMethodsShared.MakeSymbolicLink(symlinkLvl2Path, symlinkPath, ref errorMessage), errorMessage);
ConsoleLogger_Tests.cs (4)
1966IntPtr stdHandle = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); 1970uint fileType = NativeMethodsShared.GetFileType(stdHandle); 1973return fileType == NativeMethodsShared.FILE_TYPE_CHAR;
Construction\SolutionFile_NewParser_Tests.cs (1)
156return !NativeMethodsShared.IsWindows ? path.Replace('\\', '/') : path;
Construction\SolutionFile_OldParser_Tests.cs (7)
36p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln"; 58p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln"; 75p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln"; 94p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln"; 150p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln"; 611string expectedPath3 = NativeMethodsShared.IsWindows ? @"ETPProjUpgradeTest\someproj3.etp" : "ETPProjUpgradeTest/someproj3.etp"; 715p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln";
Definition\Toolset_Tests.cs (2)
54if (NativeMethodsShared.IsWindows) 209if (NativeMethodsShared.IsUnixLike)
Definition\ToolsetConfigurationReader_Tests.cs (2)
566if (NativeMethodsShared.IsWindows) 571else if (NativeMethodsShared.IsOSX)
Definition\ToolsetReader_Tests.cs (32)
133string v2Folder = NativeMethodsShared.IsWindows 135: Path.Combine(NativeMethodsShared.FrameworkBasePath, "2.0"); 136string v4Folder = NativeMethodsShared.IsWindows 138: Path.Combine(NativeMethodsShared.FrameworkBasePath, "4.0"); 218if (NativeMethodsShared.IsLinux) 364string v2Folder = NativeMethodsShared.IsWindows 366: Path.Combine(NativeMethodsShared.FrameworkBasePath, "2.0"); 505string v2Folder = NativeMethodsShared.IsWindows 507: Path.Combine(NativeMethodsShared.FrameworkBasePath, "2.0"); 752string binPath = NativeMethodsShared.IsWindows ? @"c:\someBinPath" : "/someBinPath"; 976string binPath = NativeMethodsShared.IsWindows ? @"D:\somepath" : "/somepath"; 977string binPath2 = NativeMethodsShared.IsWindows ? @"D:\somepath2" : "/somepath2"; 978string fworkPath2 = NativeMethodsShared.IsWindows 981string fworkPath4 = NativeMethodsShared.IsWindows 1091string binPath = NativeMethodsShared.IsWindows ? @"D:\somepath" : "/somepath"; 1092string binPath2 = NativeMethodsShared.IsWindows ? @"D:\somepath2" : "/somepath2"; 1164string binPath = NativeMethodsShared.IsWindows ? "c:\\x" : "/x"; 1255string v2Dir = NativeMethodsShared.IsWindows ? "D:\\windows\\Microsoft.NET\\Framework\\v2.0.x86ret" : "/windows/Microsoft.NET/Framework/v2.0.x86ret"; 1256string v4Dir = NativeMethodsShared.IsWindows ? "D:\\windows\\Microsoft.NET\\Framework\\v4.0.x86ret" : "/windows/Microsoft.NET/Framework/v4.0.x86ret"; 1610string v20Dir = NativeMethodsShared.IsWindows ? @"D:\20\some\folder\on\disk" : "/20/some/folder/on/disk"; 1611string v35Dir = NativeMethodsShared.IsWindows ? @"D:\35\some\folder\on\disk" : "/35/some/folder/on/disk"; 1874string binPath = NativeMethodsShared.IsWindows ? @"D:\somepath" : "/somepath"; 1875string overrideBinPath = NativeMethodsShared.IsWindows ? @"D:\somedifferentpath" : "/somedifferentpath"; 1920string binPath = NativeMethodsShared.IsWindows ? @"D:\somepath" : "/somepath"; 1965string binPath = NativeMethodsShared.IsWindows ? @"D:\somepath" : "/somepath"; 1966string overrideBinPath = NativeMethodsShared.IsWindows ? @"D:\someotherpath" : "/someotherpath"; 2057string binPath = NativeMethodsShared.IsWindows ? @"D:\somedifferentpath" : "/somedifferentpath"; 2099string binPath = NativeMethodsShared.IsWindows ? @"D:\somepath" : "/somepath"; 2339string overridePath = NativeMethodsShared.IsWindows ? "c:\\TaskOverridePath" : "/TaskOverridePath"; 2631string binPathConfig = NativeMethodsShared.IsWindows ? 2634string toolsPathConfig = NativeMethodsShared.IsWindows ? 2670string expectedToolsPath = NativeMethodsShared.IsWindows
Definition\ToolsetRegistryReader_Tests.cs (10)
100if (NativeMethodsShared.IsUnixLike) 181string xdir = NativeMethodsShared.IsWindows ? "c:\\xxx" : "/xxx"; 204string xdir = NativeMethodsShared.IsWindows ? "c:\\xxx" : "/xxx"; 205string ydir = NativeMethodsShared.IsWindows ? "c:\\yyy" : "/yyy"; 263string xdir = NativeMethodsShared.IsWindows ? "c:\\xxx" : "/xxx"; 264string ydir = NativeMethodsShared.IsWindows ? "c:\\yyy" : "/yyy"; 319string xdir = NativeMethodsShared.IsWindows ? "c:\\xxx" : "/xxx"; 354string xdir = NativeMethodsShared.IsWindows ? "c:\\xxx" : "/xxx"; 394string xdir = NativeMethodsShared.IsWindows ? "c:\\xxx" : "/xxx"; 484if (NativeMethodsShared.IsUnixLike)
Definition\ToolsVersion_Tests.cs (18)
33string dir = NativeMethodsShared.IsWindows ? "c:\\directory1\\directory2" : "/directory1/directory2"; 34string overrideDir = NativeMethodsShared.IsWindows ? "c:\\msbuildoverridetasks" : "/msbuildoverridetasks"; 159NativeMethodsShared.IsWindows ? "c:\\directory1\\directory2" : "/directory1/directory2", 240string dir = NativeMethodsShared.IsWindows ? "c:\\directory1\\directory2" : "/directory1/directory2"; 241string overrideDir = NativeMethodsShared.IsWindows ? "c:\\msbuildoverridetasks" : "/msbuildoverridetasks"; 926NativeMethodsShared.IsWindows ? "c:\\inline" : "/inline", 993new DefaultTasksFile(NativeMethodsShared.IsWindows 1002new DefaultTasksFile(NativeMethodsShared.IsWindows 1008new DefaultTasksFile(NativeMethodsShared.IsWindows 1014new DefaultTasksFile(NativeMethodsShared.IsWindows 1020new DefaultTasksFile(NativeMethodsShared.IsWindows 1026new DefaultTasksFile(NativeMethodsShared.IsWindows 1032new DefaultTasksFile(NativeMethodsShared.IsWindows 1040new DefaultTasksFile(NativeMethodsShared.IsWindows 1048new DefaultTasksFile(NativeMethodsShared.IsWindows 1054new DefaultTasksFile(NativeMethodsShared.IsWindows 1067new DefaultTasksFile(NativeMethodsShared.IsWindows 1076new DefaultTasksFile(NativeMethodsShared.IsWindows
Evaluation\Evaluator_Tests.cs (15)
174string fooPath = NativeMethodsShared.IsWindows ? @"c:\temp\foo.import" : "/temp/foo.import"; 175string barPath = NativeMethodsShared.IsWindows ? @"c:\temp\bar.import" : "/temp/bar.import"; 1363string targets1FileName = NativeMethodsShared.IsWindows ? @"c:\a\t1.targets" : "/a/t1.targets"; 1364string aDirName = NativeMethodsShared.IsWindows ? @"c:\a\" : "/a/"; 1365string targets2FileName = NativeMethodsShared.IsWindows ? @"c:\a\b\t2.targets" : "/a/b/t2.targets"; 1366string bDirName = NativeMethodsShared.IsWindows ? @"c:\a\b\" : "/a/b/"; 1367string targets3FileName = NativeMethodsShared.IsWindows ? @"c:\t3.targets" : "/t3.targets"; 1368string rootDirName = NativeMethodsShared.IsWindows ? @"c:\" : "/"; 1369string aProjName = NativeMethodsShared.IsWindows ? @"c:\a\p.proj" : "/a/p.proj"; 2432string msbuildPath = NativeMethodsShared.IsWindows ? 2564string msbuildPath = NativeMethodsShared.IsWindows ? Path.Combine(expected, "MSBuild") : "MSBuild"; 2799string file = NativeMethodsShared.IsWindows ? @"c:\foo\bar.csproj" : "/foo/bar.csproj"; 2818string file = NativeMethodsShared.IsWindows ? @"c:\bar.csproj" : "/bar.csproj"; 2819string dir = NativeMethodsShared.IsWindows ? @"c:\" : "/"; 3858if (NativeMethodsShared.IsUnixLike)
Evaluation\Expander_Tests.cs (11)
43private static readonly string s_rootPathPrefix = NativeMethodsShared.IsWindows ? "C:\\" : Path.VolumeSeparatorChar.ToString(); 1415NativeMethodsShared.IsWindows ? @"subdir1\engine.dll" : "subdir1/engine.dll", project.FullPath); 1419NativeMethodsShared.IsWindows ? @"subdir2\tasks.dll" : "subdir2/tasks.dll", project.FullPath); 1905string envVar = NativeMethodsShared.IsWindows ? "TEMP" : "USER"; 3879string envVar = NativeMethodsShared.IsWindows ? "TEMP" : "USER"; 3903string envVar = NativeMethodsShared.IsWindows ? "TEMP" : "USER"; 3927string envVar = NativeMethodsShared.IsWindows ? "TEMP" : "USER"; 3951string envVar = NativeMethodsShared.IsWindows ? "TEMP" : "USER"; 4343if (NativeMethodsShared.IsWindows) 4350if (NativeMethodsShared.IsWindows) 4355if (!NativeMethodsShared.IsWindows)
Evaluation\ImportFromMSBuildExtensionsPath_Tests.cs (7)
472<searchPaths os=""" + NativeMethodsShared.GetOSNameForExtensionsPath() + @"""> 554<searchPaths os=""" + NativeMethodsShared.GetOSNameForExtensionsPath() + @"""> 615<searchPaths os=""" + NativeMethodsShared.GetOSNameForExtensionsPath() + @"""> 685<searchPaths os=""" + NativeMethodsShared.GetOSNameForExtensionsPath() + @"""> 751<searchPaths os=""" + NativeMethodsShared.GetOSNameForExtensionsPath() + @"""> 818<searchPaths os=""" + NativeMethodsShared.GetOSNameForExtensionsPath() + @"""> 963<searchPaths os=""" + NativeMethodsShared.GetOSNameForExtensionsPath() + @""">
Evaluation\ItemEvaluation_Tests.cs (1)
607if (!NativeMethodsShared.IsWindows)
Evaluation\ItemSpec_Tests.cs (1)
44var absoluteRootPath = NativeMethodsShared.IsWindows
Evaluation\ProjectRootElementCache_Tests.cs (2)
71string rootedPath = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 84string projectPath = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo";
Evaluation\SimpleProjectRootElementCache_Tests.cs (11)
32string projectFile = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 33string projectFileToCache = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 46string projectFile = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 47string projectFileToCache = NativeMethodsShared.IsUnixLike ? "/Foo" : "c:\\Foo"; 60string projectFile = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 61string projectFileToCache = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 78string projectFile = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 79string projectFileToCache = NativeMethodsShared.IsUnixLike ? "/Foo" : "c:\\Foo"; 96string projectFile = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 110string projectFile = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo"; 111string projectFileToCache = NativeMethodsShared.IsUnixLike ? "/bar" : "c:\\bar";
Globbing\MSBuildGlob_Tests.cs (6)
40var globRoot = NativeMethodsShared.IsWindows ? @"c:\a" : "/a"; 116var globRoot = NativeMethodsShared.IsWindows ? @"c:\a" : "/a"; 137var globRoot = NativeMethodsShared.IsWindows ? @"c:\a" : "/a"; 157var globRoot = NativeMethodsShared.IsWindows ? @"c:\a" : "/a"; 213if (NativeMethodsShared.IsUnixLike) 360return NativeMethodsShared.IsWindows ? normalizedPath.Replace("\\\\", "\\") : normalizedPath;
Graph\IsolateProjects_Tests.cs (2)
137if (NativeMethodsShared.IsOSX) 145var disableInProcNode = !NativeMethodsShared.IsOSX;
Graph\ParallelWorkSet_Tests.cs (4)
69DegreeOfParallelism = NativeMethodsShared.GetLogicalCoreCount(), 97DegreeOfParallelism = NativeMethodsShared.GetLogicalCoreCount() 112DegreeOfParallelism = NativeMethodsShared.GetLogicalCoreCount(), 176DegreeOfParallelism = NativeMethodsShared.GetLogicalCoreCount(),
ProjectCache\ProjectCacheTests.cs (8)
680var referenceNumbers = Enumerable.Range(2, NativeMethodsShared.GetLogicalCoreCount()).ToArray(); 1413MaxNodeCount = NativeMethodsShared.GetLogicalCoreCount(), 1469var referenceNumbers = Enumerable.Range(2, NativeMethodsShared.GetLogicalCoreCount() * 2).ToArray(); 1486MaxNodeCount = NativeMethodsShared.GetLogicalCoreCount(), 1532var referenceNumbers = Enumerable.Range(2, NativeMethodsShared.GetLogicalCoreCount() * 2).ToArray(); 1546MaxNodeCount = NativeMethodsShared.GetLogicalCoreCount(), 1596var projectPaths = Enumerable.Range(0, NativeMethodsShared.GetLogicalCoreCount()) 1626MaxNodeCount = NativeMethodsShared.GetLogicalCoreCount()
TerminalLogger_Tests.cs (3)
144private readonly string _projectFile = NativeMethods.IsUnixLike ? "/src/project.proj" : @"C:\src\project.proj"; 145private readonly string _projectFile2 = NativeMethods.IsUnixLike ? "/src/project2.proj" : @"C:\src\project2.proj"; 146private readonly string _projectFileWithNonAnsiSymbols = NativeMethods.IsUnixLike ? "/src/проектТерминал/㐇𠁠𪨰𫠊𫦠𮚮⿕.proj" : @"C:\src\проектТерминал\㐇𠁠𪨰𫠊𫦠𮚮⿕.proj";
Utilities_Tests.cs (1)
84MSBuildApp.Execute([ @"c:\bin\msbuild.exe", '"' + inputFile.Path + '"', '"' + (NativeMethodsShared.IsUnixLike ? "-pp:" : "/pp:") + outputFile.Path + '"']));
Microsoft.Build.Framework (88)
BuildEnvironmentHelper.cs (12)
133if (!NativeMethods.IsWindows) 165if (NativeMethods.IsWindows && 239if (NativeMethods.IsWindows && 369NativeMethods.ProcessorArchitecture == NativeMethods.ProcessorArchitectures.X64 ? "amd64" : 370NativeMethods.ProcessorArchitecture == NativeMethods.ProcessorArchitectures.ARM64 ? "arm64" : string.Empty, 590MSBuildToolsDirectoryRoot = NativeMethods.ProcessorArchitecture switch 592NativeMethods.ProcessorArchitectures.X86 => CurrentMSBuildToolsDirectory, 593NativeMethods.ProcessorArchitectures.X64 or NativeMethods.ProcessorArchitectures.ARM64 595_ => throw new InternalErrorException("Unknown processor architecture " + NativeMethods.ProcessorArchitecture),
CommunicationsUtilities.cs (1)
218if (NativeMethods.IsWindows)
Constants.cs (2)
31internal static readonly string DotnetProcessName = NativeMethods.IsWindows ? "dotnet.exe" : "dotnet"; 46internal static readonly string MSBuildExecutableName = NativeMethods.IsWindows ? $"{MSBuildAppName}.exe" : MSBuildAppName;
EncodingUtilities.cs (3)
58if (NativeMethods.IsWindows) 64s_currentOemEncoding = Encoding.GetEncoding(NativeMethods.GetOEMCP()); 224if (!NativeMethods.IsWindows)
FileSystem\FileSystems.cs (1)
17if (NativeMethods.IsWindows)
FileSystem\WindowsFileSystem.cs (5)
61throw new PathTooLongException(SR.FormatPathTooLong(path, NativeMethods.MaxPath)); 64return NativeMethods.DirectoryExistsWindows(path); 78return NativeMethods.FileOrDirectoryExistsWindows(path); 83var fileLastWriteTime = NativeMethods.GetLastWriteFileUtcTime(path); 91NativeMethods.GetLastWriteDirectoryUtcTime(path, out var directoryLastWriteTime);
FileUtilities.cs (11)
234=> path.Length >= NativeMethods.MaxPath; // >= not > because MAX_PATH assumes a trailing null 240=> NativeMethods.IsUnixLike && path.IndexOf(WindowsDirectorySeparator) >= 0; 246=> NativeMethods.IsWindows && path.IndexOf(UnixDirectorySeparator) >= 0; 430if (NativeMethods.GetLastWriteDirectoryUtcTime(directoryPath, out lastModifiedTime)) 772if (NativeMethods.IsWindows || string.IsNullOrEmpty(value) 793if (NativeMethods.IsWindows || value.IsEmpty) 874if (NativeMethods.IsWindows) 1002if (NativeMethods.IsWindows && !EndsWithSlash(fullPath)) 1454bool hasMaxPath = NativeMethods.HasMaxPath; 1455int maxPath = NativeMethods.MaxPath; 1457return hasMaxPath && !IsRootedNoThrow(path) && NativeMethods.GetCurrentDirectory().Length + path.Length + 1 /* slash */ >= maxPath;
ItemSpecModifiers.cs (1)
547if (NativeMethods.IsWindows)
MSBuildNameIgnoreCaseComparer.cs (6)
25private static readonly NativeMethods.ProcessorArchitectures s_runningProcessorArchitecture = NativeMethods.ProcessorArchitecture; 75if ((s_runningProcessorArchitecture != NativeMethods.ProcessorArchitectures.IA64) 76&& (s_runningProcessorArchitecture != NativeMethods.ProcessorArchitectures.ARM)) 123if ((s_runningProcessorArchitecture != NativeMethods.ProcessorArchitectures.IA64) 124&& (s_runningProcessorArchitecture != NativeMethods.ProcessorArchitectures.ARM))
MultiProcessTaskEnvironmentDriver.cs (2)
34get => new AbsolutePath(NativeMethods.GetCurrentDirectory(), ignoreRootedCheck: true); 35set => NativeMethods.SetCurrentDirectory(value.Value);
NativeMethods.cs (2)
1184bool success = NativeMethods.GetFileAttributesEx(path, 0, ref data); 1186if (success && (data.fileAttributes & NativeMethods.FILE_ATTRIBUTE_DIRECTORY) == 0)
PathHelpers\AbsolutePath.cs (1)
29private static readonly StringComparer s_pathComparer = NativeMethods.IsFileSystemCaseSensitive ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase;
Utilities\FileMatcher.cs (5)
1063if (NativeMethods.IsLinux && recursionState.SearchData.DirectoryPattern != null) 1204using (var matchFileExpression = new ReuseableStringBuilder(FileSpecRegexMinLength + NativeMethods.MAX_PATH)) 1257bool isUncPath = NativeMethods.IsWindows && fixedDir.Length > 1 2273if (NativeMethods.IsWindows && 2595var maxTasks = Math.Max(1, NativeMethods.GetLogicalCoreCount() / 2);
Utilities\FrameworkLocationHelper.cs (34)
93internal static string dotNetFrameworkVersionFolderPrefixV11 = NativeMethods.IsWindows ? "v1.1" : "1.1"; // v1.1 is for Everett. 98internal static string dotNetFrameworkVersionFolderPrefixV20 = NativeMethods.IsWindows ? "v2.0" : "2.0"; // v2.0 is for Whidbey. 102internal static string dotNetFrameworkVersionFolderPrefixV30 = NativeMethods.IsWindows ? "v3.0" : "3.0"; // v3.0 is for WinFx. 116internal static string dotNetFrameworkVersionFolderPrefixV35 = NativeMethods.IsWindows ? "v3.5" : "3.5"; // v3.5 is for Orcas. 122internal static string dotNetFrameworkVersionFolderPrefixV40 = NativeMethods.IsWindows ? "v4.0" : "4.0"; 123internal static string dotNetFrameworkVersionFolderPrefixV45 = NativeMethods.IsWindows ? "v4.5" : "4.5"; 444return NativeMethods.IsUnixLike 445? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV11) 454return NativeMethods.IsUnixLike 455? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV20) 464return NativeMethods.IsUnixLike 465? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV30) 474return NativeMethods.IsUnixLike 475? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV35) 484return NativeMethods.IsUnixLike 485? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV40) 494return NativeMethods.IsUnixLike 495? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV45) 504return NativeMethods.IsUnixLike 505? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV11) 514return NativeMethods.IsUnixLike 515? Path.Combine(NativeMethods.FrameworkBasePath, dotNetFrameworkVersionFolderPrefixV20) 538if (!NativeMethods.IsWindows) 540s_fallbackDotNetFrameworkSdkInstallPath = NativeMethods.FrameworkCurrentPath; 588if (NativeMethods.IsWindows) 635if (NativeMethods.IsWindows) 829if (!NativeMethods.IsWindows) 836var frameworkPath = Path.Combine(NativeMethods.FrameworkBasePath, prefix ?? string.Empty); 986combinedPath = NativeMethods.IsWindows 988: Path.Combine(NativeMethods.FrameworkBasePath, "xbuild-frameworks"); 1196dotNetFrameworkVersionFolderPrefix: NativeMethods.IsWindows ? "v4.0" : "v4.5", 1481if (NativeMethods.IsUnixLike) 1483string frameworkPath = NativeMethods.FrameworkBasePath; 1572if (NativeMethods.IsWindows)
Utilities\ProcessExtensions.cs (2)
25if (NativeMethods.IsWindows) 29NativeMethods.KillTree(process.Id);
Microsoft.Build.Framework.UnitTests (51)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
FileClassifier_Tests.cs (4)
31var volume = NativeMethodsShared.IsWindows ? @"X:\" : "/home/usr"; 45var volume = NativeMethodsShared.IsWindows ? @"X:\" : "/home/usr"; 63var volume = NativeMethodsShared.IsWindows ? @"X:\" : "/home/usr"; 66if (NativeMethodsShared.IsLinux)
FileMatcher_Tests.cs (29)
157if (!NativeMethodsShared.IsLinux) 261ExpectNoMatches = NativeMethodsShared.IsLinux 283ExpectNoMatches = NativeMethodsShared.IsLinux, 301ExpectNoMatches = NativeMethodsShared.IsLinux, 322ExpectNoMatches = NativeMethodsShared.IsLinux, 341ExpectNoMatches = NativeMethodsShared.IsLinux, 358ExpectNoMatches = NativeMethodsShared.IsLinux, 450ExpectNoMatches = NativeMethodsShared.IsLinux, 474ExpectNoMatches = NativeMethodsShared.IsLinux, 496ExpectNoMatches = NativeMethodsShared.IsLinux, 512ExpectNoMatches = NativeMethodsShared.IsLinux, 1002if (NativeMethodsShared.IsWindows) 1016NativeMethodsShared.IsWindows ? "f:\\dir1\\dir2\\file.txt" : "/dir1/dir2/file.txt", 1017NativeMethodsShared.IsWindows ? "f:\\dir1\\dir2\\file.txt" : "/dir1/dir2/file.txt", 1470string[] strings = new string[1] { NativeMethodsShared.IsWindows ? "c:\\1.file" : "/1.file" }; 1471strings = FileMatcher.RemoveProjectDirectory(strings, NativeMethodsShared.IsWindows ? "c:\\" : "/").ToArray(); 1474strings = new string[1] { NativeMethodsShared.IsWindows ? "c:\\directory\\1.file" : "/directory/1.file" }; 1475strings = FileMatcher.RemoveProjectDirectory(strings, NativeMethodsShared.IsWindows ? "c:\\" : "/").ToArray(); 1476Assert.Equal(strings[0], NativeMethodsShared.IsWindows ? "directory\\1.file" : "directory/1.file"); 1478strings = new string[1] { NativeMethodsShared.IsWindows ? "c:\\directory\\1.file" : "/directory/1.file" }; 1479strings = FileMatcher.RemoveProjectDirectory(strings, NativeMethodsShared.IsWindows ? "c:\\directory" : "/directory").ToArray(); 1482strings = new string[1] { NativeMethodsShared.IsWindows ? "c:\\1.file" : "/1.file" }; 1483strings = FileMatcher.RemoveProjectDirectory(strings, NativeMethodsShared.IsWindows ? "c:\\directory" : "/directory").ToArray(); 1484Assert.Equal(strings[0], NativeMethodsShared.IsWindows ? "c:\\1.file" : "/1.file"); 1486strings = new string[1] { NativeMethodsShared.IsWindows ? "c:\\directorymorechars\\1.file" : "/directorymorechars/1.file" }; 1487strings = FileMatcher.RemoveProjectDirectory(strings, NativeMethodsShared.IsWindows ? "c:\\directory" : "/directory").ToArray(); 1488Assert.Equal(strings[0], NativeMethodsShared.IsWindows ? "c:\\directorymorechars\\1.file" : "/directorymorechars/1.file"); 1490if (NativeMethodsShared.IsWindows) 1873if (NativeMethodsShared.IsUnixLike)
FileUtilities_Tests.cs (17)
52string itemSpec = NativeMethodsShared.IsWindows ? @"c:\foo.txt" : "/foo.txt"; 53string itemSpecDir = NativeMethodsShared.IsWindows ? @"c:\" : "/"; 73string projectPath = NativeMethodsShared.IsWindows ? @"c:\abc\goo.proj" : @"/abc/goo.proj"; 74string projectPathDir = NativeMethodsShared.IsWindows ? @"c:\abc\" : @"/abc/"; 91if (NativeMethodsShared.IsWindows) 246Assert.Equal(NativeMethodsShared.IsWindows ? @"c:\" : "/", FileUtilities.GetDirectory(NativeMethodsShared.IsWindows ? @"c:\" : "/")); 247Assert.Equal(NativeMethodsShared.IsWindows ? @"c:\" : "/", FileUtilities.GetDirectory(NativeMethodsShared.IsWindows ? @"c:\foo" : "/foo")); 248Assert.Equal(NativeMethodsShared.IsWindows ? @"c:" : "/", FileUtilities.GetDirectory(NativeMethodsShared.IsWindows ? @"c:" : "/")); 531var isWindows = NativeMethodsShared.IsWindows; 608if (NativeMethodsShared.IsWindows) 619if (NativeMethodsShared.IsWindows) 665return !NativeMethodsShared.IsWindows || 668NativeMethodsShared.IsMaxPathLegacyWindows(); 997string root = NativeMethodsShared.IsWindows ? @"c:\" : "/";
Microsoft.Build.Tasks.Core (56)
AssemblyDependency\AssemblyInformation.cs (1)
245if (!NativeMethodsShared.IsWindows)
AssemblyDependency\AssemblyMetadata.cs (1)
30ScatterFiles = NativeMethodsShared.IsWindows ? import.Files : null;
AssemblyDependency\Reference.cs (1)
514else if (NativeMethodsShared.IsWindows)
AssemblyDependency\ResolveAssemblyReference.cs (1)
3306p => NativeMethodsShared.GetLastWriteFileUtcTime(p),
AssemblyFoldersEx.cs (1)
80if (!NativeMethodsShared.IsWindows)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
CommunicationsUtilities.cs (2)
287if (includeSessionId && NativeMethodsShared.IsWindows) 583if (!NativeMethodsShared.IsWindows)
Copy.cs (3)
44private static readonly int DefaultCopyParallelism = NativeMethodsShared.GetLogicalCoreCount() > 4 ? 6 : 4; 354TryCopyViaLink(SymbolicLinkComment, MessageImportance.Normal, sourceFileState, destinationFileState, out symbolicLinkCreated, ref errorMessage, (source, destination, errMessage) => NativeMethodsShared.MakeSymbolicLink(destination, source, ref errorMessage)); 357if (!NativeMethodsShared.IsWindows)
Exec.cs (7)
74if (NativeMethodsShared.IsUnixLike) 213if (!NativeMethodsShared.IsUnixLike) 258if (!NativeMethodsShared.IsUnixLike) 501if (NativeMethodsShared.IsWindows) 578if (NativeMethodsShared.IsUnixLike) 593if (NativeMethodsShared.IsWindows) 654protected override string ToolName => NativeMethodsShared.IsWindows ? "cmd.exe" : "sh";
FileState.cs (11)
91if (NativeMethodsShared.IsWindows) 99NativeMethodsShared.SetThreadErrorMode(1 /* ErrorModes.SEM_FAILCRITICALERRORS */, out oldMode); 104if (NativeMethodsShared.IsWindows) 106var data = new NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA(); 107bool success = NativeMethodsShared.GetFileAttributesEx(_filename, 0, ref data); 120&& _filename.Length <= NativeMethodsShared.MaxPath) 130NativeMethodsShared.ThrowExceptionForErrorCode(error); 135IsDirectory = (data.fileAttributes & NativeMethodsShared.FILE_ATTRIBUTE_DIRECTORY) != 0; 137&& (data.fileAttributes & NativeMethodsShared.FILE_ATTRIBUTE_READONLY) != 0; 178if (NativeMethodsShared.IsWindows) 180NativeMethodsShared.SetThreadErrorMode(oldMode, out _);
GenerateApplicationManifest.cs (1)
115if (!NativeMethodsShared.IsWindows)
GenerateDeploymentManifest.cs (1)
157if (!NativeMethodsShared.IsWindows)
GenerateLauncher.cs (1)
45if (!NativeMethodsShared.IsWindows)
GenerateManifestBase.cs (1)
275if (!NativeMethodsShared.IsWindows)
GenerateResource.cs (7)
1510DateTime outputTime = NativeMethodsShared.GetLastWriteFileUtcTime(outputFilePath); 1520DateTime sourceTime = NativeMethodsShared.GetLastWriteFileUtcTime(sourceFilePath); 1566DateTime linkedFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(linkedFilePath); 1653DateTime sourceTime = NativeMethodsShared.GetLastWriteFileUtcTime(Sources[0].ItemSpec); 1654DateTime outputTime = NativeMethodsShared.GetLastWriteFileUtcTime(StronglyTypedFileName); 1712DateTime time = NativeMethodsShared.GetLastWriteFileUtcTime(input.ItemSpec); 2825if (!NativeMethodsShared.HasMaxPath)
GetInstalledSDKLocations.cs (1)
127if (!NativeMethodsShared.IsWindows)
GetSDKReferenceFiles.cs (1)
230if (!NativeMethodsShared.IsWindows)
ManifestUtil\SecurityUtil.cs (1)
869if (NativeMethodsShared.IsWindows && (toolPath == null || !FileSystems.Default.FileExists(toolPath)))
NamedPipeUtil.cs (1)
26if (NativeMethodsShared.IsUnixLike)
NativeMethods.cs (6)
808if (NativeMethodsShared.IsWindows) 841if (NativeMethodsShared.IsWindows) 992if (NativeMethodsShared.IsWindows) 1246private static readonly string s_gacPath = Path.Combine(NativeMethodsShared.FrameworkBasePath, "gac"); 1292if (NativeMethodsShared.IsWindows) 1352if (NativeMethodsShared.IsWindows)
NodePipeClient.cs (1)
18private static readonly bool s_useHandhakeTimeout = !NativeMethodsShared.IsWindows;
NodePipeServer.cs (1)
32private static readonly int s_handshakeTimeout = NativeMethodsShared.IsWindows ? 0 : 60_000;
ResolveSDKReference.cs (1)
272if (!NativeMethodsShared.IsWindows)
SignFile.cs (1)
47if (!NativeMethodsShared.IsWindows)
SystemState.cs (1)
667return lastModified != DateTime.MinValue && lastModified != NativeMethodsShared.MinFileDate;
Unzip.cs (1)
269if (mode != UnixFileMode.None && !NativeMethodsShared.IsWindows)
Microsoft.Build.Tasks.UnitTests (104)
AddToWin32Manifest_Tests.cs (1)
186NativeMethodsShared.FreeLibrary(hModule);
AssemblyDependency\Miscellaneous.cs (4)
146if (NativeMethodsShared.IsWindows) 222if (NativeMethodsShared.IsWindows) 283if (NativeMethodsShared.IsWindows) 332if (NativeMethodsShared.IsWindows)
AssemblyDependency\ResolveAssemblyReferenceTestFixture.cs (1)
188protected static readonly string s_rootPathPrefix = NativeMethodsShared.IsWindows ? "C:\\" : Path.VolumeSeparatorChar.ToString();
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
AssignLinkMetadata_Tests.cs (1)
136var item = GetParentedTaskItem(NativeMethodsShared.IsUnixLike
AssignTargetPath_Tests.cs (12)
24{ new TaskItem(NativeMethodsShared.IsWindows ? @"c:\bin2\abc.efg" : "/bin2/abc.efg") }; 25t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\bin" : "/bin"; 29t.AssignedFiles[0].ItemSpec.ShouldBe(NativeMethodsShared.IsWindows ? @"c:\bin2\abc.efg" : "/bin2/abc.efg"); 40{ new TaskItem(NativeMethodsShared.IsWindows ? @"c:\f1\f2\file.txt" : "/f1/f2/file.txt") }; 41t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2"; 57NativeMethodsShared.IsWindows ? @"d:\f1\f2\f3\f4\file.txt" : "/f1/f2/f3/f4/file.txt") 63t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1" : "/x1"; 79NativeMethodsShared.IsWindows ? @"c:\f1\f2\f3\f4\file.txt" : "/f1/f2/f3/f4/file.txt") 81t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2"; 85t.AssignedFiles[0].GetMetadata("TargetPath").ShouldBe(NativeMethodsShared.IsWindows ? @"f3\f4\file.txt" : "f3/f4/file.txt"); 105itemSpec: NativeMethodsShared.IsWindows ? @"c:\f1\f2\file.txt" : "/f1/f2/file.txt", 108t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2";
CodeTaskFactoryEmbeddedFileInBinlogTestHelper.cs (2)
71projectDirectoryPath = NativeMethodsShared.IsWindows ? projectDirectoryPath.Replace(":\\", "\\") : projectDirectoryPath.Replace("/", "\\"); 123projectDirectory = NativeMethodsShared.IsWindows ? projectDirectory.Replace(":\\", "\\") : projectDirectory.Replace("/", "\\");
CombinePath_Tests.cs (11)
47string path1 = NativeMethodsShared.IsWindows ? @"c:\ghi.txt" : "/ghi.txt"; 48string path2 = NativeMethodsShared.IsWindows ? @"d:\jkl\mno.txt" : "/jkl/mno.txt"; 50string pathsToMatch = string.Format(NativeMethodsShared.IsWindows ? @" 59t.Paths = NativeMethodsShared.IsWindows 76t.BasePath = NativeMethodsShared.IsWindows ? @"c:\abc\def" : "/abc/def"; 96t.BasePath = NativeMethodsShared.IsWindows ? @"\\fileserver\public" : "/rootdir/public"; 97string path1 = NativeMethodsShared.IsWindows ? @"c:\ghi.txt" : "/ghi.txt"; 98string path2 = NativeMethodsShared.IsWindows ? @"d:\jkl\mno.txt" : "/jkl/mno.txt"; 100string pathsToMatch = string.Format(NativeMethodsShared.IsWindows ? @" 108t.Paths = NativeMethodsShared.IsWindows 126if (NativeMethodsShared.IsWindows)
Copy_Tests.cs (5)
1151(!NativeMethodsShared.IsLinux || isUseHardLinks); 1406if (NativeMethodsShared.IsWindows) 1815string invalidFile = NativeMethodsShared.IsUnixLike ? Path.Combine(temp, "!@#$%^&*()|") : "!@#$%^&*()|"; 1847Assert.False(NativeMethodsShared.IsUnixLike ? !success : success); 1853if (NativeMethodsShared.IsUnixLike)
Exec_Tests.cs (26)
146Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? "xcopy thisisanonexistentfile" : "cp thisisanonexistentfile thatisanonexistentfile"); 150Assert.Equal(NativeMethodsShared.IsWindows ? 4 : 1, exec.ExitCode); 152if (!NativeMethodsShared.IsWindows) 162int expectedExitCode = NativeMethodsShared.IsWindows ? -1 : 137; 164Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? ":foo \n goto foo" : "while true; do sleep 1; done"); 194Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? ":foo \n goto foo" : "while true; do sleep 1; done"); 208exec.ExitCode.ShouldBe(NativeMethodsShared.IsWindows ? -1 : 137); 237var cmdLine = NativeMethodsShared.IsWindows 265var cmdLine = NativeMethodsShared.IsWindows 289Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? "echo [%cd%]" : "echo [$PWD]"); 290string working = !NativeMethodsShared.IsWindows ? "/usr/lib" : 322Directory.SetCurrentDirectory(NativeMethodsShared.IsWindows ? 325Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? "echo [%cd%]" : "echo [$PWD]"); 352if (NativeMethodsShared.GetShortFilePath(newTmp) == newTmp) 389if (NativeMethodsShared.GetShortFilePath(newTmp) == newTmp) 427if (NativeMethodsShared.GetShortFilePath(newTmp) == newTmp) 464if (NativeMethodsShared.GetShortFilePath(newTmp) == newTmp) 599if (!NativeMethodsShared.IsWindows) 660if (NativeMethodsShared.IsWindows) 683if (NativeMethodsShared.IsWindows) 714if (NativeMethodsShared.IsWindows) 746var cmdLine = NativeMethodsShared.IsWindows 762var cmdLine = NativeMethodsShared.IsWindows 812var cmdLine = NativeMethodsShared.IsWindows 908exec.Command = NativeMethodsShared.IsWindows ? "echo [%MYENVVAR%]" : "echo [$myenvvar]"; 1061Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? $"type {textFilePath}" : $"cat {textFilePath}");
FindUnderPath_Tests.cs (3)
106new TaskItem(NativeMethodsShared.IsWindows ? @"C:\SomeoneElsesProject\File2.txt" : "/SomeoneElsesProject/File2.txt") }; 140Assert.Equal(NativeMethodsShared.IsWindows ? @"C:\SomeoneElsesProject\File2.txt" : "/SomeoneElsesProject/File2.txt", 163Assert.Equal(NativeMethodsShared.IsWindows ? @"C:\SomeoneElsesProject\File2.txt" : "/SomeoneElsesProject/File2.txt",
GetReferencePaths_Tests.cs (1)
278if (NativeMethodsShared.IsWindows)
MakeDir_Tests.cs (2)
92if (NativeMethodsShared.IsWindows) 116if (!NativeMethodsShared.IsWindows)
NativeMethodsShared_Tests.cs (11)
38IntPtr kernel32Dll = NativeMethodsShared.LoadLibrary("kernel32.dll"); 41IntPtr processHandle = NativeMethodsShared.NullIntPtr; 42if (kernel32Dll != NativeMethodsShared.NullIntPtr) 44processHandle = NativeMethodsShared.GetProcAddress(kernel32Dll, "GetCurrentProcessId"); 52Assert.NotEqual(processHandle, NativeMethodsShared.NullIntPtr); 63if (kernel32Dll != NativeMethodsShared.NullIntPtr) 65NativeMethodsShared.FreeLibrary(kernel32Dll); 79DateTime nonexistentFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(nonexistentFile); 92DateTime directoryTime = NativeMethodsShared.GetLastWriteFileUtcTime(directory); 106Assert.False(NativeMethodsShared.GetLastWriteDirectoryUtcTime(file, out directoryTime)); 141NativeMethodsShared.SetCurrentDirectory(nonexistentDirectory);
ReadLinesFromFile_Tests.cs (1)
225if (NativeMethodsShared.IsUnixLike)
ResolveSDKReference_Tests.cs (2)
25private readonly string _sdkPath = NativeMethodsShared.IsWindows 1519string goodSDKLocation = NativeMethodsShared.IsWindows ? "C:\\GoodSDKLocation\\" : "/GoodSDKLocation/";
ResourceHandling\GenerateResource_Tests.cs (8)
430NativeMethodsShared.IsWindows ? bitmap.ToUpper() : bitmap, 698NativeMethodsShared.IsWindows ? bitmap.ToUpper() : bitmap); 744if (!NativeMethodsShared.IsWindows) 954if (!NativeMethodsShared.IsWindows) 3107t.StronglyTypedFileName = NativeMethodsShared.IsWindows ? "||" : "\0"; 3967System.Threading.Thread.Sleep(NativeMethodsShared.IsOSX ? 1000 : 100); 4364NativeMethodsShared.IsWindows 4454NativeMethodsShared.IsWindows ? smallestBitmapFile.ToUpperInvariant() : smallestBitmapFile,
ResourceHandling\GenerateResourceOutOfProc_Tests.cs (1)
2538t.OutputResources = new ITaskItem[] { new TaskItem(NativeMethodsShared.IsWindows ? "||" : "\0") };
SdkToolsPathUtility_Tests.cs (1)
17private string _defaultSdkToolsPath = NativeMethodsShared.IsWindows ? "C:\\ProgramFiles\\WIndowsSDK\\bin" : "/ProgramFiles/WindowsSDK/bin";
SGen_Tests.cs (3)
182sgen.BuildAssemblyPath = NativeMethodsShared.IsUnixLike 200sgen.BuildAssemblyPath = NativeMethodsShared.IsUnixLike 217sgen.BuildAssemblyPath = NativeMethodsShared.IsUnixLike ? "/SomeFolder/MyAsm.dll" : "C:\\SomeFolder\\MyAsm.dll";
Touch_Tests.cs (4)
26internal static string myexisting_txt = NativeMethodsShared.IsWindows ? @"c:\touch\myexisting.txt" : @"/touch/myexisting.txt"; 27internal static string mynonexisting_txt = NativeMethodsShared.IsWindows ? @"c:\touch\mynonexisting.txt" : @"/touch/mynonexisting.txt"; 28internal static string nonexisting_txt = NativeMethodsShared.IsWindows ? @"c:\touch-nonexistent\file.txt" : @"/touch-nonexistent/file.txt"; 29internal static string myreadonly_txt = NativeMethodsShared.IsWindows ? @"c:\touch\myreadonly.txt" : @"/touch/myreadonly.txt";
Unzip_Tests.cs (1)
161if (NativeMethodsShared.IsWindows)
WriteCodeFragment_Tests.cs (1)
610public static string EscapedLineSeparator => NativeMethodsShared.IsWindows ? "\\r\\n" : "\\n";
XamlDataDrivenToolTask_Tests.cs (1)
411var cmdLine = NativeMethodsShared.IsWindows
Microsoft.Build.UnitTests.Shared (14)
BootstrapLocationAttribute.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
DriveMapping.cs (3)
29NativeMethodsShared.ThrowExceptionForErrorCode(Marshal.GetLastWin32Error()); 42NativeMethodsShared.ThrowExceptionForErrorCode(Marshal.GetLastWin32Error()); 68NativeMethodsShared.ThrowExceptionForErrorCode(err);
DummyMappedDrive.cs (2)
24if (!NativeMethodsShared.IsWindows) 60if (_mapped && NativeMethodsShared.IsWindows)
DummyMappedDriveUtils.cs (1)
25return NativeMethods.IsWindows ? new DummyMappedDrive() : default;
LongPathSupportDisabledFactAttribute.cs (1)
35if (!NativeMethodsShared.IsMaxPathLegacyWindows())
ObjectModelHelpers.cs (2)
2009NativeMethodsShared.IsWindows 2020NativeMethodsShared.IsWindows
RequiresSymbolicLinksFactAttribute.cs (2)
22if (s_runningInAzurePipeline || !NativeMethodsShared.IsWindows) 36if (!NativeMethodsShared.MakeSymbolicLink(destinationFile, sourceFile, ref errorMessage))
RunnerUtilities.cs (1)
100if (NativeMethodsShared.IsWindows)
TestEnvironment.cs (1)
655if (NativeMethodsShared.IsUnixLike)
Microsoft.Build.Utilities.Core (30)
AssemblyFoldersEx.cs (1)
80if (!NativeMethodsShared.IsWindows)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
LockCheck.cs (1)
259if (NativeMethodsShared.IsWindows)
ProcessorArchitecture.cs (11)
84string architecture = NativeMethodsShared.ProcessorArchitecture switch 86NativeMethodsShared.ProcessorArchitectures.X86 => X86, 87NativeMethodsShared.ProcessorArchitectures.X64 => AMD64, 88NativeMethodsShared.ProcessorArchitectures.IA64 => IA64, 89NativeMethodsShared.ProcessorArchitectures.ARM => ARM, 90NativeMethodsShared.ProcessorArchitectures.ARM64 => ARM64, 91NativeMethodsShared.ProcessorArchitectures.WASM => WASM, 92NativeMethodsShared.ProcessorArchitectures.S390X => S390X, 93NativeMethodsShared.ProcessorArchitectures.LOONGARCH64 => LOONGARCH64, 94NativeMethodsShared.ProcessorArchitectures.ARMV6 => ARMV6, 95NativeMethodsShared.ProcessorArchitectures.PPC64LE => PPC64LE,
ToolLocationHelper.cs (11)
1826if (NativeMethodsShared.IsWindows && platformTarget != null) 2444string registryRoot = NativeMethodsShared.IsWindows ? GetTargetPlatformMonikerRegistryRoots(registrySearchLocation) : string.Empty; 2469if (NativeMethodsShared.IsWindows) 2895if (NativeMethodsShared.IsWindows) 2917diskRoots.Add(NativeMethodsShared.FrameworkBasePath); 3392return NativeMethodsShared.ProcessorArchitectureNative switch 3394NativeMethodsShared.ProcessorArchitectures.X64 => ProcessorArchitecture.AMD64, 3395NativeMethodsShared.ProcessorArchitectures.IA64 => ProcessorArchitecture.IA64, 3396NativeMethodsShared.ProcessorArchitectures.ARM64 => ProcessorArchitecture.ARM64, 3399NativeMethodsShared.ProcessorArchitectures.X86 => null, 3400NativeMethodsShared.ProcessorArchitectures.ARM => null,
ToolTask.cs (5)
673if (NativeMethodsShared.IsWindows) 808if (NativeMethodsShared.IsWindows) 1507bool runningOnWindows = NativeMethodsShared.IsWindows; 1572batchFileForCommandLine = NativeMethodsShared.GetShortFilePath(batchFileForCommandLine); 1740if (NativeMethodsShared.IsWindows)
Microsoft.Build.Utilities.UnitTests (99)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
NativeMethodsShared_Tests.cs (11)
38IntPtr kernel32Dll = NativeMethodsShared.LoadLibrary("kernel32.dll"); 41IntPtr processHandle = NativeMethodsShared.NullIntPtr; 42if (kernel32Dll != NativeMethodsShared.NullIntPtr) 44processHandle = NativeMethodsShared.GetProcAddress(kernel32Dll, "GetCurrentProcessId"); 52Assert.NotEqual(processHandle, NativeMethodsShared.NullIntPtr); 63if (kernel32Dll != NativeMethodsShared.NullIntPtr) 65NativeMethodsShared.FreeLibrary(kernel32Dll); 79DateTime nonexistentFileTime = NativeMethodsShared.GetLastWriteFileUtcTime(nonexistentFile); 92DateTime directoryTime = NativeMethodsShared.GetLastWriteFileUtcTime(directory); 106Assert.False(NativeMethodsShared.GetLastWriteDirectoryUtcTime(file, out directoryTime)); 141NativeMethodsShared.SetCurrentDirectory(nonexistentDirectory);
ProcessExtensions_Tests.cs (4)
25var psi = NativeMethodsShared.IsWindows 36NativeMethodsShared.IsWindows ? 64if (NativeMethodsShared.IsWindows) 94if (NativeMethodsShared.IsWindows)
ProcessorArchitecture_Tests.cs (11)
17return NativeMethodsShared.ProcessorArchitecture switch 19NativeMethodsShared.ProcessorArchitectures.X86 => ProcessorArchitecture.X86, 20NativeMethodsShared.ProcessorArchitectures.X64 => ProcessorArchitecture.AMD64, 21NativeMethodsShared.ProcessorArchitectures.IA64 => ProcessorArchitecture.IA64, 22NativeMethodsShared.ProcessorArchitectures.ARM => ProcessorArchitecture.ARM, 23NativeMethodsShared.ProcessorArchitectures.ARM64 => ProcessorArchitecture.ARM64, 24NativeMethodsShared.ProcessorArchitectures.WASM => ProcessorArchitecture.WASM, 25NativeMethodsShared.ProcessorArchitectures.S390X => ProcessorArchitecture.S390X, 26NativeMethodsShared.ProcessorArchitectures.LOONGARCH64 => ProcessorArchitecture.LOONGARCH64, 27NativeMethodsShared.ProcessorArchitectures.ARMV6 => ProcessorArchitecture.ARMV6, 28NativeMethodsShared.ProcessorArchitectures.PPC64LE => ProcessorArchitecture.PPC64LE,
TaskItem_Tests.cs (2)
226from.ItemSpec = NativeMethodsShared.IsWindows ? @"c:\subdir\Monkey.txt" : "/subdir/Monkey.txt"; 227from.GetMetadata(ItemSpecModifiers.Directory).ShouldBe(NativeMethodsShared.IsWindows ? @"subdir\" : "subdir/");
ToolLocationHelper_Tests.cs (11)
372NativeMethodsShared.IsWindows ? "f:\\IDontExistAtAll" : "/IDontExistAtAll"); 384NativeMethodsShared.IsWindows ? "f:\\IDontExistAtAll" : "/IDontExistAtAll", 1260string targetFrameworkRootPath = NativeMethodsShared.IsWindows 1281string targetFrameworkRootPath = NativeMethodsShared.IsWindows 1303string targetFrameworkRootPath = NativeMethodsShared.IsWindows 1324string targetFrameworkRootPath = NativeMethodsShared.IsWindows 1347string targetFrameworkRootPath = NativeMethodsShared.IsWindows 3068string tooLongPath = NativeMethodsShared.IsWindows 3103string normalDirectory = NativeMethodsShared.IsWindows ? "c:\\SDKPath" : "/SDKPath"; 3124string frameworkPathPattern = NativeMethodsShared.IsWindows ? @"Microsoft SDKs\Windows\v8.0\ExtensionSDKs\MyFramework" : "Microsoft SDKs/Windows/v8.0/ExtensionSDKs/MyFramework"; 3125string frameworkPathPattern2 = NativeMethodsShared.IsWindows ? @"ExtensionSDKs\MyFramework" : "ExtensionSDKs/MyFramework";
ToolTask_Tests.cs (59)
43NativeMethodsShared.IsUnixLike ? "/bin" : Environment.GetFolderPath(Environment.SpecialFolder.System), 44NativeMethodsShared.IsUnixLike ? "sh" : "cmd.exe"); 114if (!NativeMethodsShared.IsWindows && string.IsNullOrEmpty(responseFileCommands) && string.IsNullOrEmpty(commandLineCommands)) 121StartInfo = GetProcessStartInfo(GenerateFullPathToTool(), NativeMethodsShared.IsWindows ? "/x" : string.Empty, null); 133t.ToolPath = NativeMethodsShared.IsWindows ? @"C:\MyAlternatePath" : "/MyAlternatePath"; 149t.ToolPath = NativeMethodsShared.IsWindows ? @"C:\MyAlternatePath" : "/MyAlternatePath"; 168string systemPath = NativeMethodsShared.IsUnixLike ? "/bin" : Environment.GetFolderPath(Environment.SpecialFolder.System); 169t.FullToolName = Path.Combine(systemPath, NativeMethodsShared.IsWindows ? "attrib.exe" : "ps"); 191t.MockCommandLineCommands = NativeMethodsShared.IsWindows ? "/C garbagegarbagegarbagegarbage.exe" : "-c garbagegarbagegarbagegarbage.exe"; 194t.ExitCode.ShouldBe(NativeMethodsShared.IsWindows ? 1 : 127); // cmd.exe error code is 1, sh error code is 127 216t.MockCommandLineCommands = NativeMethodsShared.IsWindows 243t.MockCommandLineCommands = NativeMethodsShared.IsWindows 275string singleQuote = NativeMethodsShared.IsWindows ? "'" : string.Empty; 292t.MockCommandLineCommands = NativeMethodsShared.IsWindows 316t.MockCommandLineCommands = NativeMethodsShared.IsWindows 343t.MockCommandLineCommands = NativeMethodsShared.IsWindows 373t.MockCommandLineCommands = NativeMethodsShared.IsWindows 402t.FullToolName = NativeMethodsShared.IsWindows ? "c:\\baz\\foo.exe" : "/baz/foo.exe"; 417string shellName = NativeMethodsShared.IsWindows ? "cmd.exe" : "sh"; 418string copyName = NativeMethodsShared.IsWindows ? "xcopy.exe" : "cp"; 424string systemPath = NativeMethodsShared.IsUnixLike ? "/bin" : Environment.GetFolderPath(Environment.SpecialFolder.System); 470string toolName = NativeMethodsShared.IsWindows ? "cmd.exe" : "sh"; 477string systemPath = NativeMethodsShared.IsUnixLike ? "/bin" : Environment.GetFolderPath(Environment.SpecialFolder.System); 498t.FullToolName = NativeMethodsShared.IsWindows ? "findstr.exe" : "grep"; 526t.FullToolName = NativeMethodsShared.IsWindows ? "findstr.exe" : "grep"; 548string toolName = NativeMethodsShared.IsWindows ? "cmd.exe" : "sh"; 587t.MockCommandLineCommands = NativeMethodsShared.IsWindows 614string userVarName = NativeMethodsShared.IsWindows ? "username" : "user"; 628if (NativeMethodsShared.IsWindows) 720string toolName = NativeMethodsShared.IsWindows ? "cmd" : "sh"; 762if (NativeMethodsShared.IsWindows) 801t.MockCommandLineCommands = NativeMethodsShared.IsWindows 834t.MockCommandLineCommands = NativeMethodsShared.IsWindows 931if (NativeMethodsShared.IsUnixLike // treat all UNIXy OSes as capable of UTF-8 everywhere 1071t.MockCommandLineCommands = NativeMethodsShared.IsWindows 1103t.MockCommandLineCommands = NativeMethodsShared.IsWindows ? 1134_pathToTool = NativeMethodsShared.IsUnixLike 1178return NativeMethodsShared.IsUnixLike 1297string projectDir = NativeMethodsShared.IsUnixLike ? "/tmp" : @"C:\SomeProjectDir"; 1301string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1317string projectDir = NativeMethodsShared.IsUnixLike ? "/tmp" : @"C:\SomeProjectDir"; 1325string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1341string projectDir = NativeMethodsShared.IsUnixLike ? "/projects/myapp" : @"C:\Projects\MyApp"; 1345string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1362string projectDir = NativeMethodsShared.IsUnixLike ? "/projects/myapp" : @"C:\Projects\MyApp"; 1363string overrideDir = NativeMethodsShared.IsUnixLike ? "/custom/workdir" : @"D:\Custom\WorkDir"; 1367string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1383string expectedWorkingDir = NativeMethodsShared.IsUnixLike ? "/tmp" : @"C:\SomeProjectDir"; 1392string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1415string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1436string projectDir = NativeMethodsShared.IsUnixLike ? "/tmp" : @"C:\SomeProjectDir"; 1440string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1458string toolName = NativeMethodsShared.IsWindows ? "mytesttool.exe" : "mytesttool"; 1469string fullToolName = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1495string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1514string projectDir = NativeMethodsShared.IsUnixLike ? "/tmp" : @"C:\SomeProjectDir"; 1518string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1541string toolPath = NativeMethodsShared.IsUnixLike ? "/bin/sh" : @"C:\Windows\System32\cmd.exe"; 1561string toolName = NativeMethodsShared.IsWindows ? "mytool.exe" : "mytool";
MSBuild (20)
AssemblyInfo.cs (1)
4global using NativeMethodsShared = Microsoft.Build.Framework.NativeMethods;
CommandLine\CommandLineParser.cs (1)
287int numberOfCpus = NativeMethodsShared.GetLogicalCoreCount();
CommunicationsUtilities.cs (2)
287if (includeSessionId && NativeMethodsShared.IsWindows) 583if (!NativeMethodsShared.IsWindows)
NamedPipeUtil.cs (1)
26if (NativeMethodsShared.IsUnixLike)
OutOfProcTaskHostNode.cs (2)
983NativeMethodsShared.SetCurrentDirectory(BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory); 1070NativeMethodsShared.SetCurrentDirectory(taskConfiguration.StartupDirectory);
XMake.cs (13)
1081NativeMethodsShared.RestoreConsoleMode(s_originalConsoleMode); 1115NativeMethodsShared.FrameworkName, 1803NativeMethodsShared.LongPathsStatus longPaths = NativeMethodsShared.IsLongPathsEnabled(); 1804if (longPaths != NativeMethodsShared.LongPathsStatus.NotApplicable) 1815NativeMethodsShared.SAC_State SAC_State = NativeMethodsShared.GetSACState(); 1816if (SAC_State != NativeMethodsShared.SAC_State.NotApplicable && SAC_State != NativeMethodsShared.SAC_State.Missing) 1921if (NativeMethodsShared.IsWindows && 2405(var acceptAnsiColorCodes, var outputIsScreen, s_originalConsoleMode) = NativeMethodsShared.QueryIsScreenAndTryEnableAnsiColorCodes(); 2558(_, _, s_originalConsoleMode) = NativeMethodsShared.QueryIsScreenAndTryEnableAnsiColorCodes(); 4175Console.WriteLine(ResourceUtilities.FormatResourceStringStripCodeAndKeyword("MSBuildVersionMessage", ProjectCollection.DisplayVersion, NativeMethods.FrameworkName));