97 references to Utilities
Microsoft.Build.Tasks.CodeAnalysis (15)
src\Compilers\Core\MSBuildTask\CommandLineBuilderExtension.cs (1)
268bool flagSet = Utilities.TryConvertItemMetadataToBool(parameter, metadataNames[i]);
src\Compilers\Core\MSBuildTask\Csc.cs (2)
363bool embed = Utilities.TryConvertItemMetadataToBool(reference, 404throw Utilities.GetLocalizedArgumentException(
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
1099item.ItemSpec = Utilities.GetFullPathNoThrow(item.ItemSpec);
src\Compilers\Core\MSBuildTask\MapSourceRoots.cs (5)
78return string.IsNullOrEmpty(path) ? path : EnsureEndsWithSlash(Utilities.GetFullPathNoThrow(path)); 177string nestedRoot = Utilities.FixFilePath(root.GetMetadata(Names.NestedRoot)); 180string containingRoot = NormalizePath(Utilities.FixFilePath(root.GetMetadata(Names.ContainingRoot))); 187if (Utilities.TryCombine(containingRoot, nestedRoot, out var combinedPath)) 189var fullOriginalPath = Utilities.GetFullPathNoThrow(combinedPath);
src\Compilers\Core\MSBuildTask\Utilities.cs (2)
51throw Utilities.GetLocalizedArgumentException( 77throw Utilities.GetLocalizedArgumentException(
src\Compilers\Core\MSBuildTask\Vbc.cs (4)
325Utilities.DeleteNoThrow(desiredPdbInfo.FullName); 333catch (Exception e) when (Utilities.IsIoRelatedException(e)) 374throw Utilities.GetLocalizedArgumentException(e, 582bool embed = Utilities.TryConvertItemMetadataToBool(reference, "EmbedInteropTypes");
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (82)
MapSourceRootTests.cs (82)
37new TaskItem(Utilities.FixFilePath(@"c:\packages\SourcePackage1\")), 39new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MyProject\"), new Dictionary<string, string> 43new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\"), new Dictionary<string, string> 47{ "ContainingRoot", Utilities.FixFilePath(@"c:\MyProjects\MyProject\") }, 60Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\packages\SourcePackage1\")), task.MappedSourceRoots[0].ItemSpec); 63Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath("/packages/SourcePackage2/")), task.MappedSourceRoots[1].ItemSpec); 66Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\MyProjects\MyProject\")), task.MappedSourceRoots[2].ItemSpec); 70Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\")), task.MappedSourceRoots[3].ItemSpec); 109Assert.Equal(Utilities.FixFilePath(Utilities.GetFullPathNoThrow(@"!@#:;$%^&*()_+|{}\")), task.MappedSourceRoots[0].ItemSpec); 112Assert.Equal(Utilities.FixFilePath(Utilities.GetFullPathNoThrow("****/")), task.MappedSourceRoots[1].ItemSpec); 116Assert.Equal(Utilities.FixFilePath(Utilities.GetFullPathNoThrow(@"****\|||:;\")), task.MappedSourceRoots[2].ItemSpec); 160new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MyProject\")), 161new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\a\"), new Dictionary<string, string> 164{ "ContainingRoot", Utilities.FixFilePath(@"c:\MyProjects\MyProject\") }, 166new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\"), new Dictionary<string, string> 169{ "ContainingRoot", Utilities.FixFilePath(@"c:\MyProjects\MyProject\") }, 171new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\c\"), new Dictionary<string, string> 174{ "ContainingRoot", Utilities.FixFilePath(@"c:\MyProjects\MyProject\") }, 186Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\MyProjects\MyProject\")), task.MappedSourceRoots[0].ItemSpec); 189Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\a\")), task.MappedSourceRoots[1].ItemSpec); 192Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\")), task.MappedSourceRoots[2].ItemSpec); 195Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\c\")), task.MappedSourceRoots[3].ItemSpec); 211new TaskItem(Utilities.FixFilePath(@"c:\packages\SourcePackage1\")), 212new TaskItem(Utilities.FixFilePath(@"C:\packages\SourcePackage1\")), 213new TaskItem(Utilities.FixFilePath(@"c:\packages\SourcePackage2\")), 224Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\packages\SourcePackage1\")), task.MappedSourceRoots[0].ItemSpec); 227Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"C:\packages\SourcePackage1\")), task.MappedSourceRoots[1].ItemSpec); 230Assert.Equal(Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\packages\SourcePackage2\")), task.MappedSourceRoots[2].ItemSpec); 241var path1 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\1\"); 242var path2 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\2\"); 243var path3 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\"); 269"MapSourceRoots.NoSuchTopLevelSourceRoot", "SourceRoot.ContainingRoot", "SourceRoot", Utilities.GetFullPathNoThrow(path2))) + Environment.NewLine + 271"MapSourceRoots.NoSuchTopLevelSourceRoot", "SourceRoot.ContainingRoot", "SourceRoot", Utilities.GetFullPathNoThrow(path1))) + Environment.NewLine, engine.Log); 284var path1 = Utilities.FixFilePath(@"c:\packages\SourcePackage1\"); 285var path2 = Utilities.FixFilePath(@"c:\packages\SourcePackage2\"); 286var path3 = Utilities.FixFilePath(@"c:\packages\SourcePackage3\"); 330"MapSourceRoots.ContainsDuplicate", "SourceRoot", Utilities.GetFullPathNoThrow(path1), "SourceControl", "git", "tfvc")) + Environment.NewLine + 332"MapSourceRoots.ContainsDuplicate", "SourceRoot", Utilities.GetFullPathNoThrow(path1), "RevisionId", "RevId1", "RevId2")) + Environment.NewLine + 334"MapSourceRoots.ContainsDuplicate", "SourceRoot", Utilities.GetFullPathNoThrow(path1), "NestedRoot", "NR1A", "NR1B")) + Environment.NewLine + 336"MapSourceRoots.ContainsDuplicate", "SourceRoot", Utilities.GetFullPathNoThrow(path1), "ContainingRoot", path3, "CR")) + Environment.NewLine + 338"MapSourceRoots.ContainsDuplicate", "SourceRoot", Utilities.GetFullPathNoThrow(path1), "MappedPath", "MP1", "MP2")) + Environment.NewLine + 340"MapSourceRoots.ContainsDuplicate", "SourceRoot", Utilities.GetFullPathNoThrow(path1), "SourceLinkUrl", "URL1", "URL2")) + Environment.NewLine, 346$"'{Utilities.GetFullPathNoThrow(path1)}' SourceControl='git' RevisionId='RevId1' NestedRoot='NR1A' ContainingRoot='{(deterministic ? Utilities.GetFullPathNoThrow(path3) : path3)}' MappedPath='{(deterministic ? "/_/NR1A/" : Utilities.GetFullPathNoThrow(path1))}' SourceLinkUrl='URL1'", 347$"'{Utilities.GetFullPathNoThrow(path2)}' SourceControl='git' RevisionId='' NestedRoot='NR2' ContainingRoot='{(deterministic ? Utilities.GetFullPathNoThrow(path3) : path3)}' MappedPath='{(deterministic ? "/_/NR2/" : Utilities.GetFullPathNoThrow(path2))}' SourceLinkUrl=''", 348$"'{Utilities.GetFullPathNoThrow(path3)}' SourceControl='' RevisionId='' NestedRoot='' ContainingRoot='' MappedPath='{(deterministic ? "/_/" : Utilities.GetFullPathNoThrow(path3))}' SourceLinkUrl=''", 364new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MYPROJECT\")), 365new TaskItem(Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\"), new Dictionary<string, string> 369{ "ContainingRoot", Utilities.FixFilePath(@"c:\MyProjects\MyProject\") }, 378"MapSourceRoots.NoSuchTopLevelSourceRoot", "SourceRoot.ContainingRoot", "SourceRoot", Utilities.GetFullPathNoThrow(Utilities.FixFilePath(@"c:\MyProjects\MyProject\")))) + Environment.NewLine, engine.Log); 420var path1 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\"); 451$"'{Utilities.GetFullPathNoThrow(path1)}' SourceControl='' RevisionId='' NestedRoot='a/b' ContainingRoot='{(deterministic ? Utilities.GetFullPathNoThrow(path1) : path1)}' MappedPath='{Utilities.GetFullPathNoThrow(path1)}' SourceLinkUrl=''", 463var originalPath1 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\..\c\"); 464var normalizedPath1 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\c\"); 465var originalPath2 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\b\..\c\d\..\e\"); 466var normalizedPath2 = Utilities.FixFilePath(@"c:\MyProjects\MyProject\a\c\e\"); 486var expectedMappedPath1 = deterministic ? "/_/" : Utilities.GetFullPathNoThrow(normalizedPath1); 488var expectedContainingRoot = deterministic ? Utilities.GetFullPathNoThrow(normalizedPath1) : originalPath1; 489var expectedMappedPath2 = deterministic ? "/_/e/" : Utilities.GetFullPathNoThrow(normalizedPath2); 494'{Utilities.GetFullPathNoThrow(normalizedPath1)}' SourceControl='' RevisionId='' NestedRoot='' ContainingRoot='' MappedPath='{expectedMappedPath1}' SourceLinkUrl='' 495'{Utilities.GetFullPathNoThrow(normalizedPath2)}' SourceControl='' RevisionId='' NestedRoot='{expectedNestedRoot}' ContainingRoot='{expectedContainingRoot}' MappedPath='{expectedMappedPath2}' SourceLinkUrl=''