3 writes to Path
Microsoft.Build.UnitTests.Shared (3)
TestEnvironment.cs (3)
681Path = FileUtilities.GetTemporaryFile(null, null, extension, createFile); 688Path = FileUtilities.GetTemporaryFile(rootPath, null, extension, createFile); 693Path = System.IO.Path.Combine(rootPath, fileName);
457 references to Path
Microsoft.Build.BuildCheck.UnitTests (2)
EndToEndTests.cs (2)
118_env.SetCurrentDirectory(Path.GetDirectoryName(projectFile.Path)); 123$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore" +
Microsoft.Build.CommandLine.UnitTests (46)
MSBuildServer_Tests.cs (25)
97string output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out bool success, false, _output); 103output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out success, false, _output); 112string? dir = Path.GetDirectoryName(markerFile.Path); 116_output.WriteLine($"The marker file {markerFile.Path} was created. The build task has been started. Ready to kill the server."); 121watcher.Filter = Path.GetFileName(markerFile.Path); 125TransientTestFile sleepProject = _env.CreateFile("napProject.proj", string.Format(sleepingTaskContentsFormat, markerFile.Path)); 126RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, sleepProject.Path, out _); 129output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out success, false, _output); 147string output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out bool success, false, _output); 156output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out success, false, _output); 163output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out success, false, _output); 184TransientTestFile sleepProject = _env.CreateFile("napProject.proj", string.Format(sleepingTaskContentsFormat, markerFile.Path)); 189string output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out bool success, false, _output); 193string? dir = Path.GetDirectoryName(markerFile.Path); 198_output.WriteLine($"The marker file {markerFile.Path} was created. The build task has been started."); 201watcher.Filter = Path.GetFileName(markerFile.Path); 205RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, sleepProject.Path, out _, false, _output); 215output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out success, false, _output); 221output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out success, false, _output); 244string output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path, out bool success, false, _output); 281string output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path + " /nodereuse:false", out bool success, false, _output); 294string output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, project.Path + " -interactive", out bool success, false, _output); 325string output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, $"/t:DisplayMessages {project.Path}", out bool success, false, _output); 332_env.SetCurrentDirectory(Path.GetDirectoryName(project.Path)); 333output = RunnerUtilities.ExecMSBuild(BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, $"/t:DisplayMessages {project.Path}", out success, false, _output);
TerminalLogger_Tests.cs (4)
667string logFileWithTL = env.ExpectFile(".binlog").Path; 668string logFileWithoutTL = env.ExpectFile(".binlog").Path; 671RunnerUtilities.ExecMSBuild($"{projectFile.Path} /m /bl:{logFileWithTL} -flp:logfile={Path.Combine(logFolder.Path, "logFileWithTL.log")};verbosity=diagnostic -tl:on", out bool success); 675RunnerUtilities.ExecMSBuild($"{projectFile.Path} /m /bl:{logFileWithoutTL} -flp:logfile={Path.Combine(logFolder.Path, "logFileWithoutTL.log")};verbosity=diagnostic", out success);
XMake_Tests.cs (17)
712string result = RunnerUtilities.ExecMSBuild($" {project.Path} -getProperty:Foo", out bool success); 779string results = RunnerUtilities.ExecMSBuild($" {project.Path} {extraSwitch} {graph}", out bool success); 807string results = RunnerUtilities.ExecMSBuild($" {project.Path} /p:someProperty:fdalse= ", out bool success); 833string resultFile = env.GetTempFile(".tmp").Path; 834string results = RunnerUtilities.ExecMSBuild($" {project.Path} {extraSwitch} -getResultOutputFile:{resultFile}", out bool success); 839result = RunnerUtilities.ExecMSBuild($" {project.Path} {extraSwitch} -getResultOutputFile:", out success); 866string result = RunnerUtilities.ExecMSBuild($" {project.Path} /restore {graph}", out bool success); 1314var projectPath = directory.CreateFile("my.proj", content).Path; 1331var projectPath = directory.CreateFile("my.proj", content).Path; 1352var projectPath = directory.CreateFile("my.proj", content).Path; 1449var projectPath = directory.CreateFile("my.proj", content).Path; 1468var projectPath = directory.CreateFile("my.proj", content).Path; 1505var projectPath = directory.CreateFile("my.proj", content).Path; 1527var projectPath = directory.CreateFile("my.proj", content).Path; 2433var parametersLoggerOptional = $"{logger} -verbosity:diagnostic \"{projectFile.Path}\""; 2485string output = RunnerUtilities.ExecMSBuild($"\"{testProject.Path}\" \"/bl:{binLogLocation}/output.binlog\"", out var success, _output); 2559string output = RunnerUtilities.ExecMSBuild($"\"{testSolution.Path}\" /p:Configuration=Debug", out var success, _output);
Microsoft.Build.Engine.OM.UnitTests (19)
Construction\ProjectRootElement_Tests.cs (2)
1729initialLocation = env.CreateFile().Path; 1744reloadLocation = env.CreateFile().Path;
Construction\ProjectTargetElement_Tests.cs (1)
366collection.LoadProject(file.Path).Build().ShouldBeTrue();
Definition\Project_Tests.cs (15)
3859ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 3902ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 3945File.WriteAllText(importFile.Path, contents); 3946ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 3949var import = pre.AddImport(importFile.Path); 3968eventArgs.ImportedProjectFile.ShouldBe(importFile.Path); 3992File.WriteAllText(importFile.Path, contents); 3993ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 3996var import = pre.AddImport(importFile.Path); 4015eventArgs.ImportedProjectFile.ShouldBe(importFile.Path); 4034ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4074ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4117ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4162ProjectRootElement pre1 = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4163ProjectRootElement pre2 = ProjectRootElement.Create(env.CreateFile(".proj").Path);
NugetRestoreTests.cs (1)
50RunnerUtilities.RunProcessAndGetOutput(Path.Combine(msbuildExePath, "nuget", "NuGet.exe"), "restore " + sln.Path + " -MSBuildPath \"" + msbuildExePath + "\"", out bool success, outputHelper: _output);
Microsoft.Build.Engine.UnitTests (267)
BackEnd\BuildManager_Tests.cs (54)
734string tempProject = _env.CreateFile(".proj").Path; 972var result = buildManagerSession.BuildProjectFile(_env.CreateFile("build.proj", contents).Path); 1812string projectFile = _env.CreateFile(projectFolder, ".proj").Path; 1943string p2pProject = _env.CreateFile(".Project2.proj").Path; 2029string importedProjectPath = _env.CreateFile(".proj").Path; 2030string rootProjectPath = _env.CreateFile(".proj").Path; 2130string fileName = _env.CreateFile(".proj").Path; 2198string fileName = _env.CreateFile(".proj").Path; 2249string fileName = _env.CreateFile(".proj").Path; 2317var projA = _env.CreateFile(".proj").Path; 2318var projB = _env.CreateFile(".proj").Path; 2366var projA = _env.CreateFile(".proj").Path; 2367var projB = _env.CreateFile(".proj").Path; 2432var projA = _env.CreateFile(".proj").Path; 2433var projB = _env.CreateFile(".proj").Path; 2482var projA = _env.CreateFile(".proj").Path; 2483var projB = _env.CreateFile(".proj").Path; 2534var projA = _env.CreateFile(".proj").Path; 2535var projB = _env.CreateFile(".proj").Path; 2536var projC = _env.CreateFile(".proj").Path; 2537var projD = _env.CreateFile(".proj").Path; 2629var projA = _env.CreateFile(".proj").Path; 2630var projB = _env.CreateFile(".proj").Path; 2631var projC = _env.CreateFile(".proj").Path; 2708var projA = _env.CreateFile(".proj").Path; 2709var projB = _env.CreateFile(".proj").Path; 2710var projC = _env.CreateFile(".proj").Path; 2823var projA = _env.CreateFile(".proj").Path; 2824var projB = _env.CreateFile(".proj").Path; 2825var projC = _env.CreateFile(".proj").Path; 2909var projA = _env.CreateFile(".proj").Path; 2910var projB = _env.CreateFile(".proj").Path; 2911var projC = _env.CreateFile(".proj").Path; 2978var projA = _env.CreateFile(".proj").Path; 2979var projB = _env.CreateFile(".proj").Path; 3053var projectPath1 = _env.CreateFile(".proj").Path; 3058var projectPath2 = _env.CreateFile(".proj").Path; 3121var projectPath1 = _env.CreateFile(".proj").Path; 3136var projectPath2 = _env.CreateFile(".proj").Path; 3206string projectPath1 = _env.CreateFile(".proj").Path; 3221var projectPath2 = _env.CreateFile(".proj").Path; 3304string fileName = _env.CreateFile(".proj").Path; 3520var projectFilePath = _env.CreateFile().Path; 3533FullPath = _env.CreateFile().Path 3960var entryFile = env.CreateFile(nameof(a), a).Path; 4116string project1 = _env.CreateFile(".proj").Path; 4117string project2 = _env.CreateFile(".proj").Path; 4157string project1 = _env.CreateFile(".proj").Path; 4158string project2 = _env.CreateFile(".proj").Path; 4159string project3 = _env.CreateFile(".proj").Path; 4199string project1 = _env.CreateFile(".proj").Path; 4200string project2 = _env.CreateFile(".proj").Path; 4242string project1 = _env.CreateFile(".proj").Path; 4243string project2 = _env.CreateFile(".proj").Path;
BackEnd\GenerateTemporaryTargetAssembly_Tests.cs (1)
31<FailingBuilderTask CurrentProject=""{otherproj.Path}"" />
BackEnd\IntrinsicTask_Tests.cs (2)
2470var file1 = env.CreateFile(projectDirectory).Path; 2471var file2 = env.CreateFile(projectDirectory).Path;
BackEnd\MSBuild_Tests.cs (3)
798ObjectModelHelpers.BuildTempProjectFileExpectSuccess(projectFile.Path, logger); 830ObjectModelHelpers.BuildTempProjectFileExpectSuccess(projectFile.Path, logger); 877ObjectModelHelpers.BuildTempProjectFileExpectSuccess(projectFile.Path, logger);
BackEnd\SdkResolverLoader_Tests.cs (4)
224var assemblyToLoad = env.CreateFile(".dll").Path; 249var assemblyToLoad = env.CreateFile(".dll").Path; 276var assemblyToLoad = env.CreateFile(".dll").Path; 317var assemblyToLoad = env.GetTempFile(".dll").Path;
BackEnd\TaskBuilder_Tests.cs (2)
102string results = RunnerUtilities.ExecMSBuild(projectFile.Path + " /v:diag", out bool success); 168FullPath = env.CreateFile().Path
BackEnd\TaskHostFactory_Tests.cs (1)
45ProjectInstance projectInstance = new(project.Path);
BinaryLogger_Tests.cs (11)
87_logFile = _env.ExpectFile(".binlog").Path; 138fileToReplay = _env.ExpectFile(".binlog").Path; 228string replayedLogFile = _env.ExpectFile(".binlog").Path; 356RunnerUtilities.ExecMSBuild($"{projectFile.Path} -bl:{_logFile}", out bool success); 416RunnerUtilities.ExecMSBuild($"{projectFile.Path} -nr:False -bl:{_logFile} -flp1:logfile={Path.Combine(logFolder.Path, "logFile.log")};verbosity=diagnostic -flp2:logfile={Path.Combine(logFolder.Path, "logFile2.log")};verbosity=normal", out bool success); 481string emptyFile = testFolder.CreateFile(emptyFileName).Path; 484Assert.True(NativeMethodsShared.MakeSymbolicLink(symlinkPath, testFile.Path, ref errorMessage), errorMessage); 626string consoleOutput1 = RunnerUtilities.ExecMSBuild($"{projectFile1.Path} -bl:{_logFile} -verbosity:diag -nologo", out bool success1); 628var expected1 = $"-nologo -bl:{_logFile} -verbosity:diag {projectFile1.Path}"; 634string consoleOutput2 = RunnerUtilities.ExecMSBuild($"{projectFile2.Path} -bl:{_logFile} -verbosity:{verbosity} -nologo", out bool success2); 636var expected2 = $"-nologo -bl:{_logFile} -verbosity:{verbosity} {projectFile2.Path}";
ChangeWaves_Tests.cs (1)
65Project p = collection.LoadProject(file.Path);
Construction\ProjectImportElement_Tests.cs (3)
28ProjectRootElement rootElement = ProjectRootElement.Open(projectFile.Path); 65ProjectRootElement rootElement = ProjectRootElement.Open(projectFile.Path); 124rootElement.Save(env.GetTempFile(".csproj").Path);
Construction\SolutionFile_Tests.cs (2)
276string rptprojPath = env.CreateFile(".rptproj").Path; 278string dqprojPath = env.CreateFile(".dwproj").Path;
Construction\SolutionFilter_Tests.cs (18)
119Directory.GetCurrentDirectory().ShouldNotBe(Path.GetDirectoryName(filterFile.Path)); 125ProjectGraphEntryPoint entryPoint = new(filterFile.Path, new Dictionary<string, string>()); 131graphFromSolution.ProjectNodes.Single().ProjectInstance.ProjectFileLocation.LocationString.ShouldBe(simpleProject.Path); 135SolutionFile solution = SolutionFile.Parse(filterFile.Path); 209TransientTestFile slnf = testEnvironment.CreateFile(folder, "Dev.slnf", slnfValue.Replace(@"C:\\notAPath\\MSBuild.Dev.sln", sln.Path.Replace("\\", "\\\\"))); 210InvalidProjectFileException e = Should.Throw<InvalidProjectFileException>(() => SolutionFile.Parse(slnf.Path)); 236Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""Microsoft.Build"", """ + Path.Combine("src", Path.GetFileName(microsoftBuild.Path)) + @""", ""{69BE05E2-CBDA-4D27-9733-44E12B0F5627}"" 238Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""MSBuild"", """ + Path.Combine("src", Path.GetFileName(msbuild.Path)) + @""", ""{6F92CA55-1D15-4F34-B1FE-56C0B7EB455E}"" 240Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""Microsoft.Build.CommandLine.UnitTests"", """ + Path.Combine("src", Path.GetFileName(commandLineUnitTests.Path)) + @""", ""{0ADDBC02-0076-4159-B351-2BF33FAA46B2}"" 242Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""Microsoft.Build.Tasks.UnitTests"", """ + Path.Combine("src", Path.GetFileName(tasksUnitTests.Path)) + @""", ""{CF999BDE-02B3-431B-95E6-E88D621D9CBF}"" 260""path"": """ + sln.Path.Replace("\\", "\\\\") + @""", 262""" + Path.Combine("src", Path.GetFileName(microsoftBuild.Path)!).Replace("\\", "\\\\") + @""", 263""" + Path.Combine("src", Path.GetFileName(tasksUnitTests.Path)!).Replace("\\", "\\\\") + @""" 267SolutionFile sp = SolutionFile.Parse(slnf.Path); 268sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(microsoftBuild.Path)!)).ShouldBeTrue(); 269sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(tasksUnitTests.Path)!)).ShouldBeTrue(); 272(sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(commandLineUnitTests.Path)!)) 273|| sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(msbuild.Path)!))
Construction\SolutionProjectGenerator_Tests.cs (8)
74ProjectInstance[] instances = SolutionProjectGenerator.Generate(SolutionFile.Parse(sln.Path), null, null, _buildEventContext, CreateMockLoggingService()); 117RunnerUtilities.ExecMSBuild(solutionFile.Path + " /t:classlib", out bool success); 184string output = RunnerUtilities.ExecMSBuild(solutionFile.Path + " /t:Clean;Build;Custom", out bool success); 261var output = RunnerUtilities.ExecMSBuild(solutionFile.Path + " /m /t:Clean;Build;Custom", out bool success); 866Project(`{"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"}`) = `A`, `{proj1.Path}`, `{"{786E302A-96CE-43DC-B640-D6B6CC9BF6C0}"}` 868Project(`{"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"}`) = `B`, `{proj2.Path}`, `{"{881C1674-4ECA-451D-85B6-D7C59B7F16FA}"}` 873Project(`{"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"}`) = `C`, `{proj3.Path}`, `{"{4A727FF8-65F2-401E-95AD-7C8BBFBE3167}"}` 876RunnerUtilities.ExecMSBuild("\"" + proj.Path + "\"", out bool successfulExit);
Definition\Project_Internal_Tests.cs (3)
275projectRootElement.Save(testEnvironment.CreateFile().Path); 303projectRootElement.Save(testEnvironment.CreateFile().Path); 331projectRootElement.Save(testEnvironment.CreateFile().Path);
Definition\ProjectEvaluationContext_Tests.cs (6)
100_env.CreateFile("1.proj", @"<Project> <PropertyGroup Condition=`Exists('1.file')`></PropertyGroup> </Project>".Cleanup()).Path, 101_env.CreateFile("2.proj", @"<Project> <PropertyGroup Condition=`Exists('2.file')`></PropertyGroup> </Project>".Cleanup()).Path 144var projectFile = _env.CreateFile("1.proj", @"<Project> <Import Project='1.file' Condition=`Exists('1.file')`/> <ItemGroup><Compile Include='*.cs'/></ItemGroup> </Project>".Cleanup()).Path; 931searchedPath.EvaluatedValue.ShouldBe(subdirectoryFile.Path); 937? subdirectoryFile.Path 938: rootFile.Path);
Evaluation\EvaluationLogging_Tests.cs (2)
76var importFile = env.CreateFile().Path; 81var projectFile = env.CreateFile().Path;
Evaluation\Evaluator_Tests.cs (2)
73Project project = new(projectFile.Path); 4941Project project = pc.LoadProject(tempPath.Path);
Evaluation\Expander_Tests.cs (10)
4742ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4786ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4815ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4862ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4903ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4937ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4983new ProjectInstance(projectFile.Path); 5024new ProjectInstance(projectFile.Path); 5056new ProjectInstance(projectFile.Path); 5087.ExpandIntoStringLeaveEscaped($"$([MSBuild]::RegisterBuildCheck({dummyAssemblyFile.Path}))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance, loggingContext);
EvaluationProfiler_Tests.cs (1)
306FullPath = _env.CreateFile().Path
FileLogger_Tests.cs (3)
362var logFile = env.CreateFile(".log").Path; 404fileLogger.Parameters = "logfile=" + logFile.Path; 415string log = File.ReadAllText(logFile.Path);
Graph\GetCompatiblePlatformGraph_Tests.cs (11)
59ProjectGraph graph = new ProjectGraph(entryProject.Path); 99ProjectGraph graph = new ProjectGraph(entryProject.Path); 141ProjectGraph graph = new ProjectGraph(entryProject.Path); 181ProjectGraph graph = new ProjectGraph(entryProject.Path); 210ProjectGraph graph = new ProjectGraph(entryProject.Path); 238ProjectGraph graph = new ProjectGraph(entryProject.Path); 265ProjectGraph graph = new ProjectGraph(entryProject.Path); 293ProjectGraph graph = new ProjectGraph(entryProject.Path); 320ProjectGraph graph = new ProjectGraph(entryProject.Path); 350ProjectGraph graph = new ProjectGraph(entryProject.Path); 442ProjectGraphEntryPoint entryPoint = new(solutionFile.Path, new Dictionary<string, string>());
Graph\GraphLoadedFromSolution_tests.cs (14)
41files[i] = _env.CreateFile(files[i], string.Empty).Path; 68var solutionFile = _env.CreateFile("solutionReference.sln", string.Empty).Path; 82var aggException = Should.Throw<AggregateException>(() => new ProjectGraph(root.Path)); 230{"1", _env.CreateFile("1.csproj", string.Empty).Path} 251var solutionFile = _env.CreateFile("solution.sln", solutionContents).Path; 500var solutionFile = _env.CreateFile("solution.sln", solutionContents).Path; 595var graph = new ProjectGraph(_env.CreateFile("solution.sln", solutionContents).Path); 611{"1", GraphTestingUtilities.CreateProjectFile(_env, 1, new[] {2}).Path}, 612{"2", GraphTestingUtilities.CreateProjectFile(_env, 2, extraContent: MultitargetingSpecificationPropertyGroup).Path}, 613{"3", GraphTestingUtilities.CreateProjectFile(_env, 3, new[] {4}, extraContent: MultitargetingSpecificationPropertyGroup).Path}, 614{"4", GraphTestingUtilities.CreateProjectFile(_env, 4).Path} 619var graph = new ProjectGraph(_env.CreateFile("solution.sln", solutionContents).Path); 660.Path; 694var solutionPath = _env.CreateFile("TheSolution.sln", solutionContents).Path;
Graph\IsolateProjects_Tests.cs (8)
288defaultTargets: "UndeclaredReferenceTarget").Path; 303defaultTargets: "DeclaredReferenceTarget").Path; 321defaultTargets: "BuildDeclaredReference").Path; 516var rootProjectFile = CreateTmpFile(_env).Path; 517var declaredReferenceFile = CreateTmpFile(_env).Path; 518var undeclaredReferenceFile = CreateTmpFile(_env).Path; 580".Cleanup()).Path; 597".Cleanup()).Path;
Graph\ProjectGraph_Tests.cs (78)
65var projectGraph = new ProjectGraph(entryProject.Path); 67projectGraph.ProjectNodes.First().ProjectInstance.FullPath.ShouldBe(entryProject.Path); 93Should.Throw<CircularDependencyException>(() => new ProjectGraph(entryProject.Path)); 106entryProject.Path, 118projectGraph.ProjectNodes.First().ProjectInstance.FullPath.ShouldBe(entryProject.Path); 208entryProject.Path, 230ProjectGraph graph = new ProjectGraph(entryProject.Path); 259ProjectGraph graph = new ProjectGraph(entryProject.Path); 308var projectsInCycle = new List<string> { entryProject.Path, proj3.Path, proj2.Path, entryProject.Path }; 310Should.Throw<CircularDependencyException>(() => new ProjectGraph(entryProject.Path)).Message.ShouldContain(expectedErrorMessage); 322Should.Throw<CircularDependencyException>(() => new ProjectGraph(entryProject.Path)); 342var projectsInCycle = new List<string> { proj2.Path, proj3.Path, proj7.Path, proj6.Path, proj2.Path }; 344Should.Throw<CircularDependencyException>(() => new ProjectGraph(entryProject.Path)).Message.ShouldContain(errorMessage); 357var entryPoint1 = new ProjectGraphEntryPoint(entryFile1.Path, new Dictionary<string, string> { ["B"] = "EntryPointB", ["C"] = "EntryPointC" }); 358var entryPoint2 = new ProjectGraphEntryPoint(entryFile2.Path, null); 403ProjectGraph graph = new ProjectGraph(entryProject.Path); 430ProjectGraph graph = new ProjectGraph(entryProject.Path); 461ProjectGraph graph = new ProjectGraph(entryProject.Path); 496entryProject.Path, 532ProjectGraph graph = new ProjectGraph(entryProject.Path); 563var aggException = Should.Throw<AggregateException>(() => new ProjectGraph(entryProject.Path)); 578var projectGraph = new ProjectGraph(new[] { entryProject1.Path, entryProject2.Path }); 598var entryPoint1 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary<string, string> { { "Platform", "x86" } }); 599var entryPoint2 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary<string, string> { { "Platform", "x64" } }); 637var entryPoint1 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary<string, string> { { "Platform", "x86" } }); 638var entryPoint2 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary<string, string> { { "Platform", "x64" } }); 673var projectGraph = new ProjectGraph(new[] { entryProject1.Path, entryProject2.Path, entryProject3.Path }); 818SolutionFile solutionFile = SolutionFile.Parse(slnFile.Path); 861var projectGraph = new ProjectGraph(slnFile.Path); 924var projectGraph = new ProjectGraph(entryProject.Path); 952var projectGraph = new ProjectGraph(entryProject.Path); 983var projectGraph = new ProjectGraph(entryProject.Path); 1005var projectGraph = new ProjectGraph(entryProject.Path); 1023var projectGraph = new ProjectGraph(entryProject.Path); 1046var projectGraph = new ProjectGraph(entryProject.Path); 1069var projectGraph = new ProjectGraph(entryProject.Path); 1086var projectGraph = new ProjectGraph(entryProject.Path); 1106.Path; 1140.Path; 1175extraContent: ProjectReferenceTargetsWithMultitargeting).Path; 1230.Path; 1299.Path; 1313.Path; 1394var projectGraph = new ProjectGraph(entryProject.Path); 1417var projectGraph = new ProjectGraph(entryProject.Path); 1447var projectGraph = new ProjectGraph(entryProject.Path); 1504var projectGraph = new ProjectGraph(entryProjectFile: entryProject.Path); 1632var graph = new ProjectGraph(new HashSet<string> { entryProject1.Path, entryProject2.Path }); 1901projectReferences: new[] { 2 }).Path; 1935.Path; 1975var root = CreateProjectFile(_env, 1, new[] { 2 }, null, null, multitargetingSpecification).Path; 1994var root = CreateProjectFile(env: _env, projectNumber: 1, projectReferences: new[] { 2 }, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup).Path; 2021extraContent: innerBuildViaLocalProperty).Path; 2041var root = CreateProjectFile(env: _env, projectNumber: 1, projectReferences: new[] { 2 }, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup).Path; 2060var root = CreateProjectFile(env: _env, projectNumber: 1, projectReferences: new[] { 2, 3 }, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup).Path; 2086var root = CreateProjectFile(env: _env, projectNumber: 1, projectReferences: new[] { 2, 3 }, projectReferenceTargets: null, defaultTargets: null, extraContent: extraInnerBuildReferenceSpec).Path; 2129CreateProjectFile(env: _env, projectNumber: 1, projectReferences: null, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup).Path, 2130CreateProjectFile(env: _env, projectNumber: 2, projectReferences: null, projectReferenceTargets: null, defaultTargets: null, extraContent: referenceToInnerBuild).Path 2160var root = CreateProjectFile(env: _env, projectNumber: 1, projectReferences: null, projectReferenceTargets: null, defaultTargets: null, extraContent: referenceToInnerBuild).Path; 2200.Path; 2846Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project1", "{{project1File.Path}}", "{8761499A-7280-43C4-A32F-7F41C47CA6DF}" 2848Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project2", "{{project2File.Path}}", "{2022C11A-1405-4983-BEC2-3A8B0233108F}" 2871SolutionFile solutionFile = SolutionFile.Parse(slnFile.Path); 2873ProjectGraph projectGraph = new(slnFile.Path); 2897Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project1", "{{project1File.Path}}", "{8761499A-7280-43C4-A32F-7F41C47CA6DF}" 2916SolutionFile solutionFile = SolutionFile.Parse(slnFile.Path); 2918ProjectGraph projectGraph = new(slnFile.Path);
Graph\ResultCacheBasedBuilds_Tests.cs (8)
55var project = CreateProjectFileWithBuildTargetAndItems(_env, 1).Path; 60.ToArray())).Path; 82var project = CreateProjectFileWithBuildTargetAndItems(_env, 1).Path; 127var projectFile = CreateProjectFileWithBuildTargetAndItems(_env, 1, null, defaultTargets, explicitTargets).Path; 129var outputCache = _env.DefaultTestDirectory.CreateFile("referenceCache").Path; 462outputCaches[node] = env.DefaultTestDirectory.CreateFile($"OutputCache-{ProjectNumber(node)}").Path; 556var project = CreateProjectFileWithBuildTargetAndItems(_env, 1).Path; 557var existingFile = _env.CreateFile("FileExists", string.Empty).Path;
Instance\ProjectInstance_Internal_Tests.cs (3)
755var file = env.CreateFile().Path; 884projectRootElement.Save(testEnvironment.CreateFile().Path); 912projectRootElement.Save(testEnvironment.CreateFile().Path);
ProjectCache\ProjectCacheTests.cs (4)
895BuildResult buildResult = buildSession.BuildProjectFile(project1.Path); 1131var buildResult = buildSession.BuildProjectFile(project.Path); 1346GraphBuildResult graphResult = buildSession.BuildGraph(new ProjectGraph(project.Path)); 1579.Select(i => _env.CreateFile($"project{i}.proj", project).Path)
TerminalLoggerConfiguration_Tests.cs (1)
39_cmd = $"{projectFile.Path} -target:Hello -logger:{typeof(MockLogger).FullName},{typeof(MockLogger).Assembly.Location};ReportTelemetry";
Utilities_Tests.cs (3)
94new[] { @"c:\bin\msbuild.exe", '"' + inputFile.Path + '"', 95'"' + (NativeMethodsShared.IsUnixLike ? "-pp:" : "/pp:") + outputFile.Path + '"'})); 99foreach (string line in File.ReadLines(outputFile.Path))
Microsoft.Build.Tasks.UnitTests (112)
AssemblyDependency\ResolveAssemblyReferenceCacheSerialization.cs (6)
125sysState.SerializeCache(file.Path, null); 126sysState2 = StateFileBase.DeserializeCache<SystemState>(file.Path, null); 161sysState.SerializeCache(file.Path, null); 162sysState2 = StateFileBase.DeserializeCache<SystemState>(file.Path, null); 187sysState.SerializeCache(file.Path, null); 188sysState2 = StateFileBase.DeserializeCache<SystemState>(file.Path, null);
CodeTaskFactoryEmbeddedFileInBinlogTestHelper.cs (5)
42<Code Type="Class" Language="cs" Source="{sourceClass.Path}"> 58Parameters = $"LogFile={binlog.Path}", 66string projectImportsZipPath = Path.ChangeExtension(binlog.Path, ".ProjectImports.zip"); 110Parameters = $"LogFile={binlog.Path}", 118string projectImportsZipPath = Path.ChangeExtension(binlog.Path, ".ProjectImports.zip");
Copy_Tests.cs (17)
150SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 175SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 273SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 346SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 370SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 394SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 417SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 442SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 468SourceFiles = new ITaskItem[] { new TaskItem(sourceFile.Path) }, 2524var source = env.DefaultTestDirectory.CreateFile("source.txt", "This is a source file").Path; 2525var existing = env.DefaultTestDirectory.CreateFile("destination.txt", "This is an existing file.").Path; 2948ITaskItem[] sourceFiles = { new TaskItem(sourceFile1.Path) }; 2967sourceFiles = new TaskItem[] { new TaskItem(sourceFile2.Path) }; 2985File.ReadAllText(sourceFile1.Path).ShouldBe("This is the first source temp file."); 2989Path.Combine(Path.GetDirectoryName(sourceFile2.Path), ".", Path.GetFileName(sourceFile2.Path))) // sourceFile2.Path with a "." inserted before the file name 3002File.Exists(sourceFile2.Path).ShouldBeTrue();
CreateCSharpManifestResourceName_Tests.cs (9)
389ITaskItem i = new TaskItem(resXFile.Path); 424env.SetCurrentDirectory(Path.GetDirectoryName(resourceFile.Path)); 492ITaskItem i = new TaskItem(Path.GetFileName(resXFile.Path)); 498env.SetCurrentDirectory(Path.GetDirectoryName(resXFile.Path)); 527ITaskItem i = new TaskItem(resXFile.Path); 557ITaskItem i = new TaskItem(Path.GetFileName(resXFile.Path)); 563env.SetCurrentDirectory(Path.GetDirectoryName(resXFile.Path)); 591ITaskItem i = new TaskItem(resXFile.Path); 599env.SetCurrentDirectory(Path.GetDirectoryName(resXFile.Path));
Exec_Tests.cs (1)
1040var textFilePath = env.CreateFile("leading-whitespace.txt", lineWithLeadingWhitespace).Path;
GenerateBindingRedirects_Tests.cs (4)
270string outputAppConfigFile = env.ExpectFile(".config").Path; 282string outputAppConfigFile = _env.ExpectFile(".config").Path; 320string outputAppConfig = string.IsNullOrEmpty(targetAppConfigFile) ? _env.ExpectFile(".config").Path : targetAppConfigFile; 354string appConfigFile = _env.CreateFile(transientTestFolder ?? new TransientTestFolder(), ".config").Path;
HintPathResolver_Tests.cs (3)
35bool result = ResolveHintPath(tempFile.Path); 55bool result = ResolveHintPath(Environment.NewLine + tempFile.Path + Environment.NewLine); 64bool result = ResolveHintPath(" " + tempFile.Path + " ");
RARPrecomputedCache_Tests.cs (19)
31{ Path.Combine(standardCache.Path, "assembly1"), new SystemState.FileState(now) }, 32{ Path.Combine(standardCache.Path, "assembly2"), new SystemState.FileState(now) { Assembly = new Shared.AssemblyNameExtension("hi") } } }; 37t.StateFile = standardCache.Path; 39int standardLen = File.ReadAllText(standardCache.Path).Length; 40File.Delete(standardCache.Path); 43string precomputedPath = standardCache.Path + ".cache"; 47File.Exists(standardCache.Path).ShouldBeFalse(); 69rarWriterTask.StateFile = standardCache.Path; 75string dllName = Path.Combine(Path.GetDirectoryName(standardCache.Path), "randomFolder", "dll.dll"); 84string precomputedCachePath = standardCache.Path + ".cache"; 91rarReaderTask.StateFile = standardCache.Path; 116string dllName = Path.Combine(Path.GetDirectoryName(precomputedCache.Path), "randomFolder", "dll.dll"); 118{ Path.Combine(precomputedCache.Path, "..", "assembly1", "assembly1"), new SystemState.FileState(DateTime.Now) }, 119{ Path.Combine(precomputedCache.Path, "assembly2"), new SystemState.FileState(DateTime.Now) { Assembly = new Shared.AssemblyNameExtension("hi") } }, 126rarWriterTask.AssemblyInformationCacheOutputPath = precomputedCache.Path; 131File.Delete(precomputedCache.Path); 135rarReaderTask.StateFile = precomputedCache.Path.Substring(0, precomputedCache.Path.Length - 6); // Not a real path; should not be used. 138new TaskItem(precomputedCache.Path)
ResourceHandling\GenerateResource_Tests.cs (17)
325string resxFileInput = Utilities.WriteTestResX(false, null, null, _env.CreateFile(folder, ".resx").Path); 328t.StateFile = new TaskItem(_env.GetTempFile(".cache").Path); 371string resxFileInput = Utilities.WriteTestResX(false, null, null, _env.CreateFile(folder, ".resx").Path); 374t.StateFile = new TaskItem(_env.GetTempFile(".cache").Path); 455string resxFileInput = Utilities.WriteTestResX(false, null, null, _env.CreateFile(folder, ".resx").Path); 456TaskItem stateFile = new TaskItem(_env.GetTempFile(".cache").Path); 677var firstResx = Utilities.WriteTestResX(false, null, null, _env.CreateFile(folder, ".resx").Path); 678var secondResx = Utilities.WriteTestResX(false, null, null, _env.CreateFile(folder, ".resx").Path); 679var cache = _env.GetTempFile(folder, ".cache").Path; 2031gr.Sources = new ITaskItem[] { new TaskItem(resource.Path) }; 2079t.StateFile = new TaskItem(env.GetTempFile(".cache").Path); 2082var resourcesFile = env.CreateFile(inputExtension).Path; 2085t.OutputResources = new ITaskItem[] { new TaskItem(env.GetTempFile(".resources").Path) }; 3678string resxFile = env.CreateFile("test.resx").Path; 3922File.SetLastWriteTime(dll.Path, DateTime.Now - TimeSpan.FromDays(30)); 3924var referenceItem = new TaskItem(dll.Path); 4124resgenFile = env.CreateFile(".resx", contents).Path;
ResourceHandling\MSBuildResXReader_Tests.cs (3)
167File.WriteAllText(linkedTextFile.Path, 298File.WriteAllText(linkedTextFile.Path, 304<value>{linkedTextFile.Path};{typeNameInResx}</value>
RoslynCodeTaskFactory_Tests.cs (9)
79string output = RunnerUtilities.ExecMSBuild(inlineTask.Path, out bool success); 116string output = RunnerUtilities.ExecMSBuild(assemblyProj.Path + $" /p:OutDir={Path.Combine(folder.Path, "subFolder")} /restore", out bool success); 141output = RunnerUtilities.ExecMSBuild(inlineTask.Path, out success); 297TryLoadTaskBodyAndExpectSuccess($"<Code Source=\"{file.Path}\"/>", expectedCodeType: RoslynCodeTaskFactoryCodeType.Class); 301TryLoadTaskBodyAndExpectSuccess($"<Code Source=\"{file.Path}\" Type=\"{codeType}\">code</Code>", expectedCodeType: codeType); 394$"<Code Source=\"{file.Path}\" />", 411$"<Code Source=\"{file.Path}\" Type=\"Fragment\"/>", 427$"<Code Source=\"{file.Path}\" Type=\"Method\"/>", 600$"<Code Source=\"{file.Path}\"/>",
Unzip_Tests.cs (3)
32new FileInfo(file1.Path).IsReadOnly = true; 185new FileInfo(file1.Path).IsReadOnly = true; 217SourceFiles = new ITaskItem[] { new TaskItem(file.Path), }
WriteCodeFragment_Tests.cs (2)
154string fileName = Path.GetFileName(file.Path); 161Assert.True(File.Exists(file.Path));
WriteLinesToFile_Tests.cs (10)
164string file = testEnv.ExpectFile().Path; 330File.Exists(file.Path).ShouldBeTrue(); 331File.ReadAllText(file.Path).ShouldNotBeEmpty(); 337File = new TaskItem(file.Path), 341File.Exists(file.Path).ShouldBeTrue(); 342File.ReadAllText(file.Path).ShouldBeEmpty(); 357File.Exists(file.Path).ShouldBeFalse(); 363File = new TaskItem(file.Path), 367File.Exists(file.Path).ShouldBeTrue(); 368File.ReadAllText(file.Path).ShouldBeEmpty();
ZipDirectory_Tests.cs (4)
78DestinationFile = new TaskItem(file.Path), 86_mockEngine.Log.ShouldContain(file.Path, customMessage: _mockEngine.Log); 88using (FileStream stream = new FileStream(file.Path, FileMode.Open, FileAccess.Read, FileShare.Read)) 117DestinationFile = new TaskItem(file.Path),
Microsoft.Build.UnitTests.Shared (7)
ObjectModelHelpers.cs (2)
1760nodes[parent] = (IsRoot(parent), file.Path); 1782nodes[reference] = (false, file.Path);
TestEnvironment.cs (5)
695File.WriteAllText(Path, contents ?? string.Empty); 706Assert.True(FileSystems.Default.FileExists(Path), $"A file expected as an output does not exist: {Path}"); 711FileUtilities.DeleteNoThrow(Path); 717File.Delete(Path);
Microsoft.Build.Utilities.UnitTests (4)
ToolTask_Tests.cs (4)
855OutputPath = output.Path, 860File.Exists(output.Path).ShouldBeTrue(); 864File.ReadAllText(output.Path).ShouldContain("łoł"); 868File.ReadAllText(output.Path).ShouldContain("lol");