3 writes to Path
Microsoft.Build.UnitTests.Shared (3)
TestEnvironment.cs (3)
686Path = FileUtilities.GetTemporaryFile(null, null, extension, createFile); 693Path = FileUtilities.GetTemporaryFile(rootPath, null, extension, createFile); 698Path = System.IO.Path.Combine(rootPath, fileName);
486 references to Path
Microsoft.Build.BuildCheck.UnitTests (21)
EndToEndTests.cs (21)
51string output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectFile.Path} -check", out bool success); 89string output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectFile.Path} -check", out bool success); 121string output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectFile.Path}", out bool success); 130output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectFile.Path} -check", out success); 146File.AppendAllText(editorconfigFile.Path, editorConfigChange); 149output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectFile.Path} -check", out success); 159output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectFile.Path}", out success); 178$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore" + 211var projectDirectory = Path.GetDirectoryName(projectFile.Path); 212string logFile = _env.ExpectFile(".binlog").Path; 215$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore {(checkRequested ? "-check" : string.Empty)} -bl:{logFile}", 260$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore -check", 319string? projectDirectory = Path.GetDirectoryName(projectFile.Path); 320string logFile = _env.ExpectFile(".binlog").Path; 323$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore -bl:{logFile}", 374$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore -check", out bool success, false, _env.Output); 410$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore -check", out bool success, false, _env.Output); 434$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -restore -check" + 557$"{Path.GetFileName(projectFile.Path)} /m:1 -nr:False -t:restore -check", 632_env.SetCurrentDirectory(Path.GetDirectoryName(projectFile.Path)); 644.Replace("TestFilePath", testFile.Path)
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)
709string logFileWithTL = env.ExpectFile(".binlog").Path; 710string logFileWithoutTL = env.ExpectFile(".binlog").Path; 713RunnerUtilities.ExecMSBuild($"{projectFile.Path} /m /bl:{logFileWithTL} -flp:logfile={Path.Combine(logFolder.Path, "logFileWithTL.log")};verbosity=diagnostic -tl:on", out bool success); 717RunnerUtilities.ExecMSBuild($"{projectFile.Path} /m /bl:{logFileWithoutTL} -flp:logfile={Path.Combine(logFolder.Path, "logFileWithoutTL.log")};verbosity=diagnostic", out success);
XMake_Tests.cs (17)
713string result = RunnerUtilities.ExecMSBuild($" {project.Path} -getProperty:Foo", out bool success); 780string results = RunnerUtilities.ExecMSBuild($" {project.Path} {extraSwitch} {graph}", out bool success); 808string results = RunnerUtilities.ExecMSBuild($" {project.Path} /p:someProperty:fdalse= ", out bool success); 834string resultFile = env.GetTempFile(".tmp").Path; 835string results = RunnerUtilities.ExecMSBuild($" {project.Path} {extraSwitch} -getResultOutputFile:{resultFile}", out bool success); 840result = RunnerUtilities.ExecMSBuild($" {project.Path} {extraSwitch} -getResultOutputFile:", out success); 867string result = RunnerUtilities.ExecMSBuild($" {project.Path} /restore {graph}", out bool success); 1305var projectPath = directory.CreateFile("my.proj", content).Path; 1322var projectPath = directory.CreateFile("my.proj", content).Path; 1343var projectPath = directory.CreateFile("my.proj", content).Path; 1440var projectPath = directory.CreateFile("my.proj", content).Path; 1459var projectPath = directory.CreateFile("my.proj", content).Path; 1496var projectPath = directory.CreateFile("my.proj", content).Path; 1518var projectPath = directory.CreateFile("my.proj", content).Path; 2484var parametersLoggerOptional = $"{logger} -verbosity:diagnostic \"{projectFile.Path}\""; 2536string output = RunnerUtilities.ExecMSBuild($"\"{testProject.Path}\" \"/bl:{binLogLocation}/output.binlog\"", out var success, _output); 2610string output = RunnerUtilities.ExecMSBuild($"\"{testSolution.Path}\" /p:Configuration=Debug", out var success, _output);
Microsoft.Build.Engine.OM.UnitTests (21)
Construction\ProjectRootElement_Tests.cs (2)
1744initialLocation = env.CreateFile().Path; 1760reloadLocation = env.CreateFile().Path;
Construction\ProjectTargetElement_Tests.cs (1)
360collection.LoadProject(file.Path).Build().ShouldBeTrue();
Construction\SolutionFile_Tests.cs (2)
691string solutionPath = convertToSlnx ? ConvertToSlnx(sln.Path) : sln.Path;
Definition\Project_Tests.cs (15)
3892ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 3935ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 3978File.WriteAllText(importFile.Path, contents); 3979ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 3982var import = pre.AddImport(importFile.Path); 4001eventArgs.ImportedProjectFile.ShouldBe(importFile.Path); 4025File.WriteAllText(importFile.Path, contents); 4026ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4029var import = pre.AddImport(importFile.Path); 4048eventArgs.ImportedProjectFile.ShouldBe(importFile.Path); 4067ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4107ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4150ProjectRootElement pre = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4195ProjectRootElement pre1 = ProjectRootElement.Create(env.CreateFile(".proj").Path); 4196ProjectRootElement 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 (270)
BackEnd\BuildManager_Tests.cs (54)
741string tempProject = _env.CreateFile(".proj").Path; 990var result = buildManagerSession.BuildProjectFile(_env.CreateFile("build.proj", contents).Path); 1877string projectFile = _env.CreateFile(projectFolder, ".proj").Path; 2008string p2pProject = _env.CreateFile(".Project2.proj").Path; 2094string importedProjectPath = _env.CreateFile(".proj").Path; 2095string rootProjectPath = _env.CreateFile(".proj").Path; 2195string fileName = _env.CreateFile(".proj").Path; 2263string fileName = _env.CreateFile(".proj").Path; 2314string fileName = _env.CreateFile(".proj").Path; 2382var projA = _env.CreateFile(".proj").Path; 2383var projB = _env.CreateFile(".proj").Path; 2431var projA = _env.CreateFile(".proj").Path; 2432var projB = _env.CreateFile(".proj").Path; 2497var projA = _env.CreateFile(".proj").Path; 2498var projB = _env.CreateFile(".proj").Path; 2547var projA = _env.CreateFile(".proj").Path; 2548var projB = _env.CreateFile(".proj").Path; 2599var projA = _env.CreateFile(".proj").Path; 2600var projB = _env.CreateFile(".proj").Path; 2601var projC = _env.CreateFile(".proj").Path; 2602var projD = _env.CreateFile(".proj").Path; 2694var projA = _env.CreateFile(".proj").Path; 2695var projB = _env.CreateFile(".proj").Path; 2696var projC = _env.CreateFile(".proj").Path; 2773var projA = _env.CreateFile(".proj").Path; 2774var projB = _env.CreateFile(".proj").Path; 2775var projC = _env.CreateFile(".proj").Path; 2888var projA = _env.CreateFile(".proj").Path; 2889var projB = _env.CreateFile(".proj").Path; 2890var projC = _env.CreateFile(".proj").Path; 2974var projA = _env.CreateFile(".proj").Path; 2975var projB = _env.CreateFile(".proj").Path; 2976var projC = _env.CreateFile(".proj").Path; 3043var projA = _env.CreateFile(".proj").Path; 3044var projB = _env.CreateFile(".proj").Path; 3118var projectPath1 = _env.CreateFile(".proj").Path; 3123var projectPath2 = _env.CreateFile(".proj").Path; 3186var projectPath1 = _env.CreateFile(".proj").Path; 3201var projectPath2 = _env.CreateFile(".proj").Path; 3271string projectPath1 = _env.CreateFile(".proj").Path; 3286var projectPath2 = _env.CreateFile(".proj").Path; 3369string fileName = _env.CreateFile(".proj").Path; 3587var projectFilePath = _env.CreateFile().Path; 3600project.FullPath = _env.CreateFile().Path; 4027var entryFile = env.CreateFile(nameof(a), a).Path; 4183string project1 = _env.CreateFile(".proj").Path; 4184string project2 = _env.CreateFile(".proj").Path; 4224string project1 = _env.CreateFile(".proj").Path; 4225string project2 = _env.CreateFile(".proj").Path; 4226string project3 = _env.CreateFile(".proj").Path; 4266string project1 = _env.CreateFile(".proj").Path; 4267string project2 = _env.CreateFile(".proj").Path; 4309string project1 = _env.CreateFile(".proj").Path; 4310string project2 = _env.CreateFile(".proj").Path;
BackEnd\GenerateTemporaryTargetAssembly_Tests.cs (1)
31<FailingBuilderTask CurrentProject=""{otherproj.Path}"" />
BackEnd\IntrinsicTask_Tests.cs (2)
2528var file1 = env.CreateFile(projectDirectory).Path; 2529var file2 = env.CreateFile(projectDirectory).Path;
BackEnd\MSBuild_Tests.cs (3)
795ObjectModelHelpers.BuildTempProjectFileExpectSuccess(projectFile.Path, logger); 827ObjectModelHelpers.BuildTempProjectFileExpectSuccess(projectFile.Path, logger); 874ObjectModelHelpers.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)
103string results = RunnerUtilities.ExecMSBuild(projectFile.Path + " /v:diag", out bool success); 170project.FullPath = 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_NewParser_Tests.cs (2)
140string solutionPath = convertToSlnx ? ConvertToSlnx(sln.Path) : sln.Path;
Construction\SolutionFile_OldParser_Tests.cs (2)
313string rptprojPath = env.CreateFile(".rptproj").Path; 315string dqprojPath = env.CreateFile(".dwproj").Path;
Construction\SolutionFilter_Tests.cs (19)
123Directory.GetCurrentDirectory().ShouldNotBe(Path.GetDirectoryName(filterFile.Path)); 129ProjectGraphEntryPoint entryPoint = new(filterFile.Path, new Dictionary<string, string>()); 135graphFromSolution.ProjectNodes.Single().ProjectInstance.ProjectFileLocation.LocationString.ShouldBe(simpleProject.Path); 139SolutionFile solution = SolutionFile.Parse(filterFile.Path); 213TransientTestFile slnf = testEnvironment.CreateFile(folder, "Dev.slnf", slnfValue.Replace(@"C:\\notAPath\\MSBuild.Dev.sln", sln.Path.Replace("\\", "\\\\"))); 214InvalidProjectFileException e = Should.Throw<InvalidProjectFileException>(() => SolutionFile.Parse(slnf.Path)); 242Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""Microsoft.Build"", """ + Path.Combine("src", Path.GetFileName(microsoftBuild.Path)) + @""", ""{69BE05E2-CBDA-4D27-9733-44E12B0F5627}"" 244Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""MSBuild"", """ + Path.Combine("src", Path.GetFileName(msbuild.Path)) + @""", ""{6F92CA55-1D15-4F34-B1FE-56C0B7EB455E}"" 246Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""Microsoft.Build.CommandLine.UnitTests"", """ + Path.Combine("src", Path.GetFileName(commandLineUnitTests.Path)) + @""", ""{0ADDBC02-0076-4159-B351-2BF33FAA46B2}"" 248Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""Microsoft.Build.Tasks.UnitTests"", """ + Path.Combine("src", Path.GetFileName(tasksUnitTests.Path)) + @""", ""{CF999BDE-02B3-431B-95E6-E88D621D9CBF}"" 266""path"": """ + (convertToSlnx ? ConvertToSlnx(sln.Path) : sln.Path).Replace("\\", "\\\\") + @""", 268""" + Path.Combine("src", Path.GetFileName(microsoftBuild.Path)!).Replace("\\", "\\\\") + @""", 269""" + Path.Combine("src", Path.GetFileName(tasksUnitTests.Path)!).Replace("\\", "\\\\") + @""" 273SolutionFile sp = SolutionFile.Parse(slnf.Path); 274sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(microsoftBuild.Path)!)).ShouldBeTrue(); 275sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(tasksUnitTests.Path)!)).ShouldBeTrue(); 278(sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(commandLineUnitTests.Path)!)) 279|| sp.ProjectShouldBuild(Path.Combine("src", Path.GetFileName(msbuild.Path)!))
Construction\SolutionProjectGenerator_Tests.cs (8)
78ProjectInstance[] instances = SolutionProjectGenerator.Generate(SolutionFile.Parse(sln.Path), null, null, _buildEventContext, CreateMockLoggingService()); 123RunnerUtilities.ExecMSBuild(solutionFile.Path + " /t:classlib", out bool success); 192string output = RunnerUtilities.ExecMSBuild(solutionFile.Path + " /t:Clean;Build;Custom", out bool success); 271var output = RunnerUtilities.ExecMSBuild(solutionFile.Path + " /m /t:Clean;Build;Custom", out bool success); 890Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "A", "{{proj1.Path}}", "{786E302A-96CE-43DC-B640-D6B6CC9BF6C0}" 892Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "B", "{{proj2.Path}}", "{881C1674-4ECA-451D-85B6-D7C59B7F16FA}" 897Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C", "{{proj3.Path}}", "{4A727FF8-65F2-401E-95AD-7C8BBFBE3167}" 900RunnerUtilities.ExecMSBuild("\"" + proj.Path + "\"", out bool successfulExit);
Definition\Project_Internal_Tests.cs (3)
277projectRootElement.Save(testEnvironment.CreateFile().Path); 305projectRootElement.Save(testEnvironment.CreateFile().Path); 333projectRootElement.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; 932searchedPath.EvaluatedValue.ShouldBe(subdirectoryFile.Path); 938? subdirectoryFile.Path 939: rootFile.Path);
Evaluation\EvaluationLogging_Tests.cs (2)
77var importFile = env.CreateFile().Path; 82var projectFile = env.CreateFile().Path;
Evaluation\Evaluator_Tests.cs (3)
66Assert.Throws<InvalidProjectFileException>(() => collection.LoadProject(projectFile.Path)); 90Project project = new(projectFile.Path); 5025Project project = pc.LoadProject(tempPath.Path);
Evaluation\Expander_Tests.cs (10)
4798ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4842ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4871ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4918ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4959ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 4993ProjectInstance projectInstance = new ProjectInstance(projectFile.Path); 5039new ProjectInstance(projectFile.Path); 5080new ProjectInstance(projectFile.Path); 5112new ProjectInstance(projectFile.Path); 5178.ExpandIntoStringLeaveEscaped($"$([MSBuild]::RegisterBuildCheck({dummyAssemblyFile.Path}))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance);
EvaluationProfiler_Tests.cs (1)
306project.FullPath = _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 (13)
41files[i] = _env.CreateFile(files[i], string.Empty).Path; 69var solutionFile = _env.CreateFile("solutionReference.sln", string.Empty).Path; 83var aggException = Should.Throw<AggregateException>(() => new ProjectGraph(root.Path)); 231{"1", _env.CreateFile("1.csproj", string.Empty).Path} 252var solutionFile = _env.CreateFile("solution.sln", solutionContents).Path; 501var solutionFile = _env.CreateFile("solution.sln", solutionContents).Path; 596var graph = new ProjectGraph(_env.CreateFile("solution.sln", solutionContents).Path); 612{"1", GraphTestingUtilities.CreateProjectFile(_env, 1, new[] {2}).Path}, 613{"2", GraphTestingUtilities.CreateProjectFile(_env, 2, extraContent: MultitargetingSpecificationPropertyGroup).Path}, 614{"3", GraphTestingUtilities.CreateProjectFile(_env, 3, new[] {4}, extraContent: MultitargetingSpecificationPropertyGroup).Path}, 615{"4", GraphTestingUtilities.CreateProjectFile(_env, 4).Path} 620var graph = new ProjectGraph(_env.CreateFile("solution.sln", solutionContents).Path); 673var 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)
765var file = env.CreateFile().Path; 897projectRootElement.Save(testEnvironment.CreateFile().Path); 925projectRootElement.Save(testEnvironment.CreateFile().Path);
ProjectCache\ProjectCacheTests.cs (4)
895BuildResult buildResult = buildSession.BuildProjectFile(project1.Path); 1131var buildResult = buildSession.BuildProjectFile(project.Path); 1347GraphBuildResult graphResult = buildSession.BuildGraph(new ProjectGraph(project.Path)); 1580.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 (117)
AddToWin32Manifest_Tests.cs (1)
104var projectFile = env.CreateFile(projectFolder, "test.csproj", projectContent).Path;
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 + " ");
MSBuildInternalMessage_Tests.cs (1)
44var projectFile = env.CreateFile(env.CreateFolder(), "test.csproj", projectContent).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\"/>", 603$"<Code Source=\"{file.Path}\"/>",
Unzip_Tests.cs (6)
33new FileInfo(file1.Path).IsReadOnly = true; 186new FileInfo(file1.Path).IsReadOnly = true; 218SourceFiles = new ITaskItem[] { new TaskItem(file.Path), } 464string output = RunnerUtilities.RunProcessAndGetOutput($"/bin/sh", $"-c \"{command} {sourceFile.Path}\"", out bool success); 467ExecuteCommand("chmod +x", sourceFile.Path); 468var permissions = ExecuteCommand("ls -l", sourceFile.Path).Substring(0, 10);
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)
1769nodes[parent] = (IsRoot(parent), file.Path); 1791nodes[reference] = (false, file.Path);
TestEnvironment.cs (5)
700File.WriteAllText(Path, contents ?? string.Empty); 711Assert.True(FileSystems.Default.FileExists(Path), $"A file expected as an output does not exist: {Path}"); 716FileUtilities.DeleteNoThrow(Path); 722File.Delete(Path);
Microsoft.Build.Utilities.UnitTests (4)
ToolTask_Tests.cs (4)
856OutputPath = output.Path, 861File.Exists(output.Path).ShouldBeTrue(); 865File.ReadAllText(output.Path).ShouldContain("łoł"); 869File.ReadAllText(output.Path).ShouldContain("lol");