196 references to FileUtilities
Microsoft.Build.Utilities.Core (106)
BuildEnvironmentHelper.cs (9)
150
var vsRoot =
FileUtilities
.GetFolderAbove(vsProcess, 3);
202
var msBuildExe = Path.Combine(
FileUtilities
.GetFolderAbove(buildAssembly), "MSBuild.exe");
203
var msBuildDll = Path.Combine(
FileUtilities
.GetFolderAbove(buildAssembly), "MSBuild.dll");
360
return
FileUtilities
.GetFolderAbove(msBuildAssembly,
369
return
FileUtilities
.CombinePaths(
445
return
FileUtilities
.ExecutingAssemblyPath;
604
var potentialAmd64FromX86 =
FileUtilities
.CombinePaths(MSBuildToolsDirectoryRoot, "amd64", msBuildExeName);
605
var potentialARM64FromX86 =
FileUtilities
.CombinePaths(MSBuildToolsDirectoryRoot, "arm64", msBuildExeName);
677
defaultSdkPath =
FileUtilities
.CombinePaths(VisualStudioInstallRootDirectory, "MSBuild", "Sdks");
CommandLineBuilder.cs (1)
334
fileName =
FileUtilities
.FixFilePath(fileName);
DebugUtils.cs (5)
32
string environmentDebugPath =
FileUtilities
.TrimAndStripAnyQuotes(Environment.GetEnvironmentVariable("MSBUILDDEBUGPATH"));
37
if (!string.IsNullOrWhiteSpace(debugDirectory) &&
FileUtilities
.CanWriteToDirectory(debugDirectory))
41
else if (
FileUtilities
.CanWriteToDirectory(Directory.GetCurrentDirectory()))
47
debugDirectory = Path.Combine(
FileUtilities
.TempFileDirectory, "MSBuild_Logs");
59
FileUtilities
.EnsureDirectoryExists(debugDirectory);
ErrorUtilities.cs (1)
543
if (
FileUtilities
.PathIsInvalid(parameter))
ExceptionHandling.cs (3)
74
:
FileUtilities
.TempFileDirectory;
359
using (StreamWriter writer =
FileUtilities
.OpenWrite(s_dumpFileName, append: true))
366
using (StreamWriter writer =
FileUtilities
.OpenWrite(s_dumpFileName, append: true))
FileMatcher.cs (17)
39
internal static readonly char[] directorySeparatorCharacters =
FileUtilities
.Slashes;
224
path =
FileUtilities
.FixFilePath(path);
588
filespec =
FileUtilities
.FixFilePath(filespec);
862
Debug.Assert(
FileUtilities
.PathsEqual(searchToExclude.BaseDirectory, recursionState.BaseDirectory), "Expected exclude search base directory to match include search base directory");
1237
bool isSurroundedBySlashes = (i == 0 ||
FileUtilities
.IsAnySlash(str[i - 1]))
1238
&& i < str.Length - 2 &&
FileUtilities
.IsAnySlash(str[i + 2]);
1374
else if (
FileUtilities
.IsAnySlash(ch))
1419
if (startIndex >= str.Length || !
FileUtilities
.IsAnySlash(str[startIndex]))
1428
bool isSeparator = i < str.Length - 1 &&
FileUtilities
.IsAnySlash(str[i + 1]);
1429
bool isRelativeSeparator = i < str.Length - 2 && str[i + 1] == '.' &&
FileUtilities
.IsAnySlash(str[i + 2]);
2127
FileUtilities
.IsAnySlash(wildcard[2]) &&
2128
FileUtilities
.IsAnySlash(wildcard[wildcardLength - 3]) &&
2133
if (wildcard.IndexOfAny(
FileUtilities
.Slashes, 3, wildcardLength - 6) == -1)
2294
if (!
FileUtilities
.IsAnySlash(directoryPart[i]))
2324
while (index < aString.Length &&
FileUtilities
.IsAnySlash(aString[index]))
2341
if (
FileUtilities
.PathsEqual(filespecUnescaped, excludeSpec))
2657
int index = directoryPath.LastIndexOfAny(
FileUtilities
.Slashes);
FileUtilities.cs (1)
747
internal static string ExecutingAssemblyPath => Path.GetFullPath(AssemblyUtilities.GetAssemblyLocation(typeof(
FileUtilities
).GetTypeInfo().Assembly));
FrameworkLocationHelper.cs (1)
1535
this._pathToDotNetFrameworkReferenceAssemblies =
FileUtilities
.EnsureTrailingSlash(referencePath);
Modifiers.cs (31)
110
if (name ==
FileUtilities
.ItemSpecModifiers.RootDir)
126
if (name ==
FileUtilities
.ItemSpecModifiers.FullPath)
130
if (name ==
FileUtilities
.ItemSpecModifiers.Filename)
138
if (name ==
FileUtilities
.ItemSpecModifiers.Identity)
153
if (name ==
FileUtilities
.ItemSpecModifiers.Directory)
161
if (name ==
FileUtilities
.ItemSpecModifiers.Extension)
176
if (name ==
FileUtilities
.ItemSpecModifiers.CreatedTime)
184
if (name ==
FileUtilities
.ItemSpecModifiers.RelativeDir)
200
if (name ==
FileUtilities
.ItemSpecModifiers.AccessedTime)
208
if (name ==
FileUtilities
.ItemSpecModifiers.ModifiedTime)
216
if (name ==
FileUtilities
.ItemSpecModifiers.RecursiveDir)
256
if (name ==
FileUtilities
.ItemSpecModifiers.DefiningProjectName)
262
if (name ==
FileUtilities
.ItemSpecModifiers.DefiningProjectFullPath)
274
if (name ==
FileUtilities
.ItemSpecModifiers.DefiningProjectDirectory)
282
if (name ==
FileUtilities
.ItemSpecModifiers.DefiningProjectExtension)
392
if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.FullPath, StringComparison.OrdinalIgnoreCase))
409
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.RootDir, StringComparison.OrdinalIgnoreCase))
425
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.Filename, StringComparison.OrdinalIgnoreCase))
440
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.Extension, StringComparison.OrdinalIgnoreCase))
454
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.RelativeDir, StringComparison.OrdinalIgnoreCase))
458
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.Directory, StringComparison.OrdinalIgnoreCase))
495
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.RecursiveDir, StringComparison.OrdinalIgnoreCase))
500
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.Identity, StringComparison.OrdinalIgnoreCase))
504
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.ModifiedTime, StringComparison.OrdinalIgnoreCase))
510
FileInfo info =
FileUtilities
.GetFileInfoNoThrow(unescapedItemSpec);
522
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.CreatedTime, StringComparison.OrdinalIgnoreCase))
538
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.AccessedTime, StringComparison.OrdinalIgnoreCase))
563
if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.DefiningProjectDirectory, StringComparison.OrdinalIgnoreCase))
574
if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.DefiningProjectFullPath, StringComparison.OrdinalIgnoreCase))
578
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.DefiningProjectName, StringComparison.OrdinalIgnoreCase))
582
else if (string.Equals(modifier,
FileUtilities
.ItemSpecModifiers.DefiningProjectExtension, StringComparison.OrdinalIgnoreCase))
PrintLineDebuggerWriters.cs (1)
74
var executingAssembly =
FileUtilities
.ExecutingAssemblyPath;
TargetPlatformSDK.cs (1)
108
set => _path = value != null ?
FileUtilities
.EnsureTrailingSlash(value) : null;
TaskItem.cs (13)
102
_itemSpec = treatAsFilePath ?
FileUtilities
.FixFilePath(itemSpec) : itemSpec;
129
if (!
FileUtilities
.ItemSpecModifiers.IsDerivableItemSpecModifier(key))
150
_definingProject = EscapingUtilities.EscapeWithCaching(sourceItem.GetMetadata(
FileUtilities
.ItemSpecModifiers.DefiningProjectFullPath));
155
_definingProject = sourceItemAsITaskItem2.GetMetadataValueEscaped(
FileUtilities
.ItemSpecModifiers.DefiningProjectFullPath);
182
_itemSpec =
FileUtilities
.FixFilePath(value);
201
_itemSpec =
FileUtilities
.FixFilePath(value);
214
int count = (_metadata?.Count ?? 0) +
FileUtilities
.ItemSpecModifiers.All.Length;
223
metadataNames.AddRange(
FileUtilities
.ItemSpecModifiers.All);
233
public int MetadataCount => (_metadata?.Count ?? 0) +
FileUtilities
.ItemSpecModifiers.All.Length;
264
ErrorUtilities.VerifyThrowArgument(!
FileUtilities
.ItemSpecModifiers.IsItemSpecModifier(metadataName),
286
ErrorUtilities.VerifyThrowArgument(!
FileUtilities
.ItemSpecModifiers.IsDerivableItemSpecModifier(metadataName),
456
if (
FileUtilities
.ItemSpecModifiers.IsDerivableItemSpecModifier(metadataName))
460
metadataValue =
FileUtilities
.ItemSpecModifiers.GetItemSpecModifier(null, _itemSpec, _definingProject, metadataName, ref _fullPath);
TaskLoggingHelper.cs (1)
1329
using (StreamReader fileStream =
FileUtilities
.OpenRead(fileName, Encoding.GetEncoding(0))) // HIGHCHAR: Use ANSI for logging messages.
TempFileUtilities.cs (1)
74
return
FileUtilities
.EnsureTrailingSlash(basePath);
ToolLocationHelper.cs (14)
660
if (
FileUtilities
.DirectoryExistsNoThrow(legacyWindowsMetadataLocation))
662
legacyWindowsMetadataLocation =
FileUtilities
.EnsureTrailingSlash(legacyWindowsMetadataLocation);
1765
return
FileUtilities
.EnsureNoTrailingSlash(referenceAssemblyDirectory);
1839
return
FileUtilities
.EnsureNoTrailingSlash(legacyMsCorlib20Path);
1856
return
FileUtilities
.EnsureNoTrailingSlash(referenceAssemblyDirectory);
2422
if (
FileUtilities
.DirectoryExistsNoThrow(referenceAssemblyPath))
2424
referenceAssemblyPath =
FileUtilities
.EnsureTrailingSlash(referenceAssemblyPath);
2548
if (
FileUtilities
.FileExistsNoThrow(pathToSDKManifest))
2550
targetPlatformSDK.ExtensionSDKs.Add(SDKKey,
FileUtilities
.EnsureTrailingSlash(sdkVersionDirectory.FullName));
2817
if (
FileUtilities
.DirectoryExistsNoThrow(directoryName))
2823
targetPlatformSDK.ExtensionSDKs.Add(sdkKey,
FileUtilities
.EnsureTrailingSlash(directoryName));
2930
diskRoots.RemoveAll(x => !
FileUtilities
.DirectoryExistsNoThrow(x));
3051
if (
FileUtilities
.FileExistsNoThrow(pathToPlatformManifest))
3053
sdk.Platforms.Add(sdkKey,
FileUtilities
.EnsureTrailingSlash(platformVersion.FullName));
ToolsetElement.cs (1)
85
string tempFileName =
FileUtilities
.GetTemporaryFile();
ToolTask.cs (4)
597
responseFile =
FileUtilities
.GetTemporaryFileName(".rsp");
600
using (StreamWriter responseFileStream =
FileUtilities
.OpenWrite(responseFile, false, ResponseFileEncoding))
1409
_temporaryBatchFile =
FileUtilities
.GetTemporaryFile(".cmd");
1416
_temporaryBatchFile =
FileUtilities
.GetTemporaryFile(".sh");
TrackedDependencies\TrackedDependencies.cs (1)
81
if (!
FileUtilities
.FileExistsNoThrow(item.ItemSpec))
Microsoft.Build.Utilities.UnitTests (90)
CommandLineBuilder_Tests.cs (2)
110
c.AppendFileNamesIfNotNull(new[] { "Form1.resx",
FileUtilities
.FixFilePath("built\\Form1.resources") }, ",");
114
c.ShouldBe(
FileUtilities
.FixFilePath(@"Form1.resx,built\Form1.resources"));
NativeMethodsShared_Tests.cs (3)
77
string nonexistentFile =
FileUtilities
.GetTemporaryFileName();
90
string directory =
FileUtilities
.GetTemporaryDirectory(createDirectory: true);
103
string file =
FileUtilities
.GetTemporaryFile();
PlatformManifest_Tests.cs (7)
43
manifestDirectory =
FileUtilities
.GetTemporaryDirectory();
52
FileUtilities
.DeleteDirectoryNoThrow(manifestDirectory, recursive: true);
68
manifestDirectory =
FileUtilities
.GetTemporaryDirectory();
78
FileUtilities
.DeleteDirectoryNoThrow(manifestDirectory, recursive: true);
325
_manifestDirectory =
FileUtilities
.GetTemporaryDirectory();
333
if (
FileUtilities
.DirectoryExistsNoThrow(_manifestDirectory))
335
FileUtilities
.DeleteDirectoryNoThrow(_manifestDirectory, recursive: true);
TaskItem_Tests.cs (32)
45
to.GetMetadata(
FileUtilities
.ItemSpecModifiers.Filename).ShouldBe("Monkey");
46
to.GetMetadata(
FileUtilities
.ItemSpecModifiers.Extension).ShouldBe(".txt");
47
to.GetMetadata(
FileUtilities
.ItemSpecModifiers.RelativeDir).ShouldBe(string.Empty);
92
taskItem.MetadataNames.Cast<string>().ShouldBeSetEquivalentTo(
FileUtilities
.ItemSpecModifiers.All);
93
taskItem.MetadataCount.ShouldBe(
FileUtilities
.ItemSpecModifiers.All.Length);
98
taskItem.MetadataNames.Cast<string>().ShouldBeSetEquivalentTo(
FileUtilities
.ItemSpecModifiers.All.Concat(new[] { "m" }));
99
taskItem.MetadataCount.ShouldBe(
FileUtilities
.ItemSpecModifiers.All.Length + 1);
117
h[
FileUtilities
.ItemSpecModifiers.Filename] = "foo";
118
h[
FileUtilities
.ItemSpecModifiers.Extension] = "bar";
124
t.GetMetadata(
FileUtilities
.ItemSpecModifiers.Filename).ShouldBe("bamboo");
125
t.GetMetadata(
FileUtilities
.ItemSpecModifiers.Extension).ShouldBe(".baz");
138
t.SetMetadata(
FileUtilities
.ItemSpecModifiers.FullPath, "bazbaz");
158
t.RemoveMetadata(
FileUtilities
.ItemSpecModifiers.RootDir);
173
t.MetadataCount.ShouldBe(
FileUtilities
.ItemSpecModifiers.All.Length);
177
t.MetadataCount.ShouldBe(
FileUtilities
.ItemSpecModifiers.All.Length + 1);
185
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.FullPath).ShouldBe(
196
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.RootDir).ShouldBe(Path.GetPathRoot(from.GetMetadata(
FileUtilities
.ItemSpecModifiers.FullPath)));
204
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.Filename).ShouldBe("Monkey");
212
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.Extension).ShouldBe(".txt");
220
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.RelativeDir).Length.ShouldBe(0);
228
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.Directory).ShouldBe(NativeMethodsShared.IsWindows ? @"subdir\" : "subdir/");
236
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.Directory).ShouldBe(@"subdir\");
245
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.RecursiveDir).Length.ShouldBe(0);
253
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.Identity).ShouldBe("Monkey.txt");
260
from.ItemSpec =
FileUtilities
.GetTemporaryFile();
262
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.ModifiedTime).Length.ShouldBeGreaterThan(0);
264
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.CreatedTime).Length.ShouldBeGreaterThan(0);
266
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.AccessedTime).Length.ShouldBeGreaterThan(0);
270
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.ModifiedTime).Length.ShouldBe(0);
272
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.CreatedTime).Length.ShouldBe(0);
274
from.GetMetadata(
FileUtilities
.ItemSpecModifiers.AccessedTime).Length.ShouldBe(0);
TaskLoggingHelper_Tests.cs (1)
176
file =
FileUtilities
.GetTemporaryFileName();
TestAssemblyInfo.cs (1)
76
FileUtilities
.ClearTempFileDirectory();
ToolLocationHelper_Tests.cs (41)
91
FileUtilities
.DeleteWithoutTrailingBackslash(tempDirectory, true);
218
FileUtilities
.DeleteDirectoryNoThrow(platformRootFolder, true);
243
FileUtilities
.DeleteWithoutTrailingBackslash(tempDirectory, true);
268
FileUtilities
.DeleteWithoutTrailingBackslash(tempDirectory, true);
294
FileUtilities
.DeleteWithoutTrailingBackslash(tempDirectory, true);
320
FileUtilities
.DeleteWithoutTrailingBackslash(tempDirectory, true);
363
FileUtilities
.DeleteWithoutTrailingBackslash(tempDirectory, true);
482
FileUtilities
.DeleteWithoutTrailingBackslash(tempDirectory, true);
615
FileUtilities
.DeleteWithoutTrailingBackslash(fakeEverettPath);
1415
FileUtilities
.DeleteWithoutTrailingBackslash(redist40Directory, true);
1420
FileUtilities
.DeleteWithoutTrailingBackslash(redist41Directory, true);
1450
FileUtilities
.DeleteWithoutTrailingBackslash(redist41Directory, true);
1480
FileUtilities
.DeleteWithoutTrailingBackslash(redist41Directory, true);
1510
FileUtilities
.DeleteWithoutTrailingBackslash(redist41Directory, true);
1540
FileUtilities
.DeleteWithoutTrailingBackslash(redist40Directory, true);
1572
FileUtilities
.DeleteWithoutTrailingBackslash(redist41Directory, true);
1607
FileUtilities
.DeleteWithoutTrailingBackslash(redist41Directory, true);
1641
FileUtilities
.DeleteWithoutTrailingBackslash(redist41Directory, true);
1704
FileUtilities
.DeleteWithoutTrailingBackslash(framework41Directory, true);
1709
FileUtilities
.DeleteWithoutTrailingBackslash(framework40Directory, true);
1714
FileUtilities
.DeleteWithoutTrailingBackslash(framework39Directory, true);
1765
FileUtilities
.DeleteWithoutTrailingBackslash(framework40Directory, true);
1770
FileUtilities
.DeleteWithoutTrailingBackslash(framework39Directory, true);
1821
FileUtilities
.DeleteWithoutTrailingBackslash(framework41Directory, true);
1826
FileUtilities
.DeleteWithoutTrailingBackslash(framework40Directory, true);
2204
string dotNet40Path =
FileUtilities
.EnsureNoTrailingSlash(referencePaths[0]);
2287
string dotNet40Path =
FileUtilities
.EnsureNoTrailingSlash(referencePaths[0]);
2946
if (
FileUtilities
.DirectoryExistsNoThrow(_fakeStructureRoot))
2948
FileUtilities
.DeleteDirectoryNoThrow(_fakeStructureRoot, true);
2954
if (
FileUtilities
.DirectoryExistsNoThrow(_fakeStructureRoot2))
2956
FileUtilities
.DeleteDirectoryNoThrow(_fakeStructureRoot2, true);
3271
FileUtilities
.DeleteWithoutTrailingBackslash(frameworkPath, true /* for recursive deletion */);
3272
FileUtilities
.DeleteWithoutTrailingBackslash(frameworkPath2, true /* for recursive deletion */);
3406
FileUtilities
.DeleteWithoutTrailingBackslash(manifestPath, true /* for recursive deletion */);
3467
FileUtilities
.DeleteWithoutTrailingBackslash(manifestPath, true /* for recursive deletion */);
3573
FileUtilities
.DeleteDirectoryNoThrow(testDirectoryRoot, true);
3604
FileUtilities
.DeleteDirectoryNoThrow(testDirectoryRoot, true);
3645
FileUtilities
.DeleteDirectoryNoThrow(testDirectoryRoot, true);
3673
FileUtilities
.DeleteDirectoryNoThrow(testDirectoryRoot, true);
4533
FileUtilities
.DeleteDirectoryNoThrow(tempPath, true);
4568
FileUtilities
.DeleteDirectoryNoThrow(tempPath, true);
ToolTask_Tests.cs (3)
448
string tempFile =
FileUtilities
.GetTemporaryFileName();
476
string tempFile =
FileUtilities
.GetTemporaryFileName();
507
string tempFile =
FileUtilities
.GetTemporaryFileName();