1 write to ProjectInstance
Microsoft.Build (1)
Graph\ProjectGraphNode.cs (1)
31ProjectInstance = projectInstance;
171 references to ProjectInstance
Microsoft.Build (37)
BackEnd\BuildManager\BuildManager.cs (3)
1951ProjectErrorUtilities.VerifyThrowInvalidProject(entryPointNode.ProjectInstance.Targets.Count > 0, entryPointNode.ProjectInstance.ProjectFileLocation, "NoTargetSpecified"); 2034node.ProjectInstance,
BackEnd\Components\ProjectCache\ProjectCacheService.cs (1)
115foreach (ProjectCacheDescriptor projectCacheDescriptor in GetProjectCacheDescriptors(node.ProjectInstance))
Graph\GraphBuilder.cs (14)
160project: currentNode.ProjectInstance, 164definingFileEscaped: currentNode.ProjectInstance.FullPath), 206var projectPath = project.Value.GraphNode.ProjectInstance.FullPath; 236referencingNode.ProjectInstance, 238referencedNode.ProjectInstance.FullPath, 239referencingNode.ProjectInstance.FullPath); 480FormatCircularDependencyError(new List<string> { node.ProjectInstance.FullPath, node.ProjectInstance.FullPath }); 489var projectsInCycle = new List<string> { referenceNode.ProjectInstance.FullPath }; 499if (loadReference.projectsInCycle[0].Equals(node.ProjectInstance.FullPath)) 502loadReference.projectsInCycle.Add(referenceNode.ProjectInstance.FullPath); 503loadReference.projectsInCycle.Add(node.ProjectInstance.FullPath); 514loadReference.projectsInCycle.Add(referenceNode.ProjectInstance.FullPath); 688return string.Join(";", reference.ProjectInstance.DefaultTargets);
Graph\GraphBuildRequestData.cs (2)
201yield return entryPoint.ProjectInstance.FullPath; 221return node.ProjectInstance.GlobalProperties.AsReadOnly();
Graph\ProjectGraph.cs (8)
517var nodeName = Path.GetFileNameWithoutExtension(node.ProjectInstance.FullPath); 521node.ProjectInstance.GlobalProperties.OrderBy(kvp => kvp.Key) 624var entryTargets = ImmutableList.CreateRange(entryPointNode.ProjectInstance.DefaultTargets); 639var entryTargets = ImmutableList.CreateRange(entryPointNode.ProjectInstance.DefaultTargets); 666ProjectGraphBuildRequest entryEdge = new(node, ImmutableList.CreateRange(node.ProjectInstance.DefaultTargets)); 691ProjectGraphNode GetNodeForProject(ProjectInSolution project) => EntryPointNodes.First(node => string.Equals(node.ProjectInstance.FullPath, project.AbsolutePath)); 723var targetsToPropagate = ProjectInterpretation.TargetsToPropagate.FromProjectAndEntryTargets(node.ProjectInstance, requestedTargets); 737referenceNode.ProjectInstance.DefaultTargets,
Graph\ProjectGraphNode.cs (6)
53var truncatedProjectFile = FileUtilities.TruncatePathToTrailingSegments(ProjectInstance.FullPath, 2); 56$"{truncatedProjectFile}, #GlobalProps={ProjectInstance.GlobalProperties.Count}, #Props={ProjectInstance.Properties.Count}, #Items={ProjectInstance.Items.Count}, #in={ReferencingProjects.Count}, #out={ProjectReferences.Count}"; 90return new ConfigurationMetadata(ProjectInstance.FullPath, ProjectInstance.GlobalPropertiesDictionary);
Graph\ProjectInterpretation.cs (3)
82ProjectInstance requesterInstance = projectGraphNode.ProjectInstance; 531.Where(t => !t.SkipIfNonexistent || projectGraphNode.ProjectInstance.Targets.ContainsKey(t.Target)) 554ProjectInstance projectInstance = projectGraphNode.ProjectInstance;
Microsoft.Build.Engine.UnitTests (131)
BackEnd\BuildManager_Tests.cs (6)
201.ProjectInstance.FullPath, 4211var node1 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project1, StringComparison.OrdinalIgnoreCase)); 4215var node2 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project2, StringComparison.OrdinalIgnoreCase)); 4296var node1 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project1, StringComparison.OrdinalIgnoreCase)); 4300var node2 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project2, StringComparison.OrdinalIgnoreCase)); 4353graph.GraphRoots.First().ProjectInstance.FullPath,
Construction\SolutionFilter_Tests.cs (1)
137graphFromSolution.ProjectNodes.Single().ProjectInstance.ProjectFileLocation.LocationString.ShouldBe(simpleProject.Path);
Graph\GetCompatiblePlatformGraph_Tests.cs (16)
60GetFirstNodeWithProjectNumber(graph, 1).ProjectInstance.GlobalProperties.ContainsKey("Platform").ShouldBeFalse(); 100GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 101GetFirstNodeWithProjectNumber(graph, 3).ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 142GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties.ContainsKey("Platform").ShouldBeFalse(); 143GetFirstNodeWithProjectNumber(graph, 3).ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 182GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties["Platform"].ShouldBe("AnyCPU"); 183GetFirstNodeWithProjectNumber(graph, 3).ProjectInstance.GlobalProperties["Platform"].ShouldBe("AnyCPU"); 211GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties["Platform"].ShouldBe("x64"); 239GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 266GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties["Platform"].ShouldBe("AnyCPU"); 294GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 324GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GlobalProperties.ContainsKey("Platform").ShouldBeFalse(); 351GetFirstNodeWithProjectNumber(graph, 2).ProjectInstance.GetPropertyValue("Platform").ShouldBe(GetFirstNodeWithProjectNumber(graph, 1).ProjectInstance.GetPropertyValue("Platform")); 447GetFirstNodeWithProjectNumber(graphFromSolution, 2).ProjectInstance.GetPropertyValue("Platform").ShouldBe("AnyCPU", "Project2 should have followed the sln config to AnyCPU"); 448GetFirstNodeWithProjectNumber(graphFromSolution, 3).ProjectInstance.GetPropertyValue("Platform").ShouldBe("x64", "Project3 isn't in the solution so it should have negotiated to x64 to match Project1");
Graph\GraphLoadedFromSolution_tests.cs (2)
718return node.ProjectInstance.GlobalProperties["Configuration"]; 723return node.ProjectInstance.GlobalProperties["Platform"];
Graph\GraphTestingUtilities.cs (14)
60string expectedPropertiesMetadata = $"{InnerBuildPropertyName}={innerBuild.ProjectInstance.GlobalProperties[InnerBuildPropertyName]}"; 68.Where(p => p.ProjectType == ProjectInterpretation.ProjectType.InnerBuild && p.ProjectInstance.FullPath == outerBuild.ProjectInstance.FullPath) 95node.ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(EmptyGlobalProperties.AddRange(additionalGlobalProperties)); 96node.ProjectInstance.GetProperty(InnerBuildPropertyName).ShouldBeNull(); 105outerBuild.ProjectInstance.GetProperty(InnerBuildPropertyName).ShouldBeNull(); 106outerBuild.ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(EmptyGlobalProperties.AddRange(additionalGlobalProperties)); 118var innerBuildPropertyValue = innerBuild.ProjectInstance.GetPropertyValue(InnerBuildPropertyName); 124innerBuild.ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder( 138return graph.ProjectNodes.Where(node => node.ProjectInstance.FullPath.EndsWith(projectNum + ".proj")); 157.Where(p => p.ProjectType == ProjectInterpretation.ProjectType.InnerBuild && p.ProjectInstance.FullPath.Equals(outerBuild.ProjectInstance.FullPath)) 169return Path.GetFileNameWithoutExtension(node.ProjectInstance.FullPath); 193return node.ProjectInstance.FullPath;
Graph\ProjectGraph_Tests.cs (67)
67projectGraph.ProjectNodes.First().ProjectInstance.FullPath.ShouldBe(entryProject.Path); 118projectGraph.ProjectNodes.First().ProjectInstance.FullPath.ShouldBe(entryProject.Path); 372root1.ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor1); 373root1.ProjectReferences.First(r => GetProjectNumber(r) == 3).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor1); 374root1.ProjectReferences.First(r => GetProjectNumber(r) == 4).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor1); 379root2.ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor2); 380root2.ProjectReferences.First(r => GetProjectNumber(r) == 4).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor2); 381root2.ProjectReferences.First(r => GetProjectNumber(r) == 5).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor2); 410GetFirstNodeWithProjectNumber(graph, 2).ProjectReferences.First().ProjectInstance.FullPath.ShouldEndWith("4.proj"); 411GetFirstNodeWithProjectNumber(graph, 2).ProjectReferences.First().ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(EmptyGlobalProperties); 412GetFirstNodeWithProjectNumber(graph, 3).ProjectReferences.First().ProjectInstance.FullPath.ShouldEndWith("4.proj"); 413GetFirstNodeWithProjectNumber(graph, 3).ProjectReferences.First().ProjectInstance.GlobalProperties.Count.ShouldBeGreaterThan(1); 432GetFirstNodeWithProjectNumber(graph, 3).ProjectInstance.GlobalProperties["A"].ShouldBe("B"); 539GetFirstNodeWithProjectNumber(graph, 2).ProjectReferences.First().ProjectInstance.FullPath.ShouldEndWith("5.proj"); 540GetFirstNodeWithProjectNumber(graph, 2).ProjectReferences.First().ProjectInstance.GlobalProperties["FoO"].ShouldBe("bar"); 544GetFirstNodeWithProjectNumber(graph, 4).ProjectReferences.First().ProjectInstance.FullPath.ShouldEndWith("5.proj"); 545GetFirstNodeWithProjectNumber(graph, 4).ProjectReferences.First().ProjectInstance.GlobalProperties["FoO"].ShouldBe("BAR"); 611entryPointNode1.ProjectInstance.FullPath.ShouldBe(entryPointNode2.ProjectInstance.FullPath); 612entryPointNode1.ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 613entryPointNode2.ProjectInstance.GlobalProperties["Platform"].ShouldBe("x64"); 619entryPointNode1.ProjectReferences.First().ProjectInstance.FullPath.ShouldBe(entryPointNode2.ProjectReferences.First().ProjectInstance.FullPath); 620entryPointNode1.ProjectReferences.First().ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 621entryPointNode2.ProjectReferences.First().ProjectInstance.GlobalProperties["Platform"].ShouldBe("x64"); 650entryPointNode1.ProjectInstance.FullPath.ShouldBe(entryPointNode2.ProjectInstance.FullPath); 651entryPointNode1.ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 652entryPointNode2.ProjectInstance.GlobalProperties["Platform"].ShouldBe("x64"); 658entryPointNode1.ProjectReferences.First().ProjectInstance.GlobalProperties.ContainsKey("Platform").ShouldBeFalse(); 863projectGraph.EntryPointNodes.Select(node => node.ProjectInstance.FullPath).ShouldBe(new[] { project1Path, project2Path, project3Path, project6Path, project8Path }, ignoreOrder: true); 865projectGraph.GraphRoots.Select(node => node.ProjectInstance.FullPath).ShouldBe(new[] { project1Path, project6Path }, ignoreOrder: true); 868ProjectGraphNode project1Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project1Path); 869project1Node.ProjectInstance.GlobalProperties["Configuration"].ShouldBe("Debug"); 870project1Node.ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 872project1Node.ProjectReferences.Select(node => node.ProjectInstance.FullPath).ShouldBe(new[] { project2Path, project3Path, project8Path }, ignoreOrder: true); 874ProjectGraphNode project2Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project2Path); 875project2Node.ProjectInstance.GlobalProperties["Configuration"].ShouldBe("Debug"); 876project2Node.ProjectInstance.GlobalProperties["Platform"].ShouldBe("Win32"); 878project2Node.ProjectReferences.Select(node => node.ProjectInstance.FullPath).ShouldBe(new[] { project4Path }, ignoreOrder: true); 880ProjectGraphNode project3Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project3Path); 881project3Node.ProjectInstance.GlobalProperties["Configuration"].ShouldBe("Debug"); 882project3Node.ProjectInstance.GlobalProperties["Platform"].ShouldBe("Win32"); 884project3Node.ProjectReferences.Select(node => node.ProjectInstance.FullPath).ShouldBe(new[] { project5Path }, ignoreOrder: true); 887ProjectGraphNode project4Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project4Path); 888project4Node.ProjectInstance.GlobalProperties.ContainsKey("Configuration").ShouldBeFalse(); 889project4Node.ProjectInstance.GlobalProperties.ContainsKey("Platform").ShouldBeFalse(); 893ProjectGraphNode project5Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project5Path); 894project5Node.ProjectInstance.GlobalProperties["Configuration"].ShouldBe("Debug"); 895project5Node.ProjectInstance.GlobalProperties["Platform"].ShouldBe("Win32"); 899ProjectGraphNode project6Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project6Path); 900project6Node.ProjectInstance.GlobalProperties["Configuration"].ShouldBe("Debug"); 901project6Node.ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 905Assert.DoesNotContain(projectGraph.ProjectNodes, node => node.ProjectInstance.FullPath == project7Path); 907ProjectGraphNode project8Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project8Path); 908project8Node.ProjectInstance.GlobalProperties["Configuration"].ShouldBe("Debug"); 909project8Node.ProjectInstance.GlobalProperties["Platform"].ShouldBe("x86"); 1860foreach (var globalProperty in node.ProjectInstance.GlobalProperties) 2105var innerBuildWithCommonReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "a"); 2108var referenceNumbersSet = innerBuildWithCommonReferences.ProjectReferences.Select(r => Path.GetFileNameWithoutExtension(r.ProjectInstance.FullPath)).ToHashSet(); 2111var innerBuildWithAdditionalReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "b"); 2114referenceNumbersSet = innerBuildWithAdditionalReferences.ProjectReferences.Select(r => Path.GetFileNameWithoutExtension(r.ProjectInstance.FullPath)).ToHashSet(); 2143var referencedInnerBuild = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GetPropertyValue(InnerBuildPropertyName) == "a"); 2220var innerBuild1WithReferenceToInnerBuild2 = outerBuild1.ProjectReferences.FirstOrDefault(n => n.ProjectType == ProjectInterpretation.ProjectType.InnerBuild && n.ProjectInstance.GlobalProperties[InnerBuildPropertyName] == "a"); 2229innerBuild2.ProjectInstance.GlobalProperties[InnerBuildPropertyName].ShouldBe("a"); 2336node.ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(expectedGlobalProperties); 2351projectGraph.ProjectNodes.First().ProjectInstance.GlobalProperties[PropertyNames.IsGraphBuild].ShouldBe("xyz");
Graph\ResultCacheBasedBuilds_Tests.cs (5)
310node.ProjectInstance.FullPath, 350var rootNode = topoSortedNodes.First(n => Path.GetFileNameWithoutExtension(n.ProjectInstance.FullPath) == "1"); 471node.ProjectInstance.FullPath, 474targetListsPerNode?[node] != null ? targetListsPerNode?[node] : node.ProjectInstance.DefaultTargets); 510private static string ProjectNumber(ProjectGraphNode node) => Path.GetFileNameWithoutExtension(node.ProjectInstance.FullPath);
ProjectCache\ProjectCacheTests.cs (19)
502var buildResult = buildSession.BuildProjectFile(node.ProjectInstance.FullPath); 538logger.FullLog.ShouldNotContain($"EntryPoint: {graph.GraphRoots.First().ProjectInstance.FullPath}"); 539logger.FullLog.ShouldContain($"EntryPoint: {graph.GraphRoots.First().ProjectReferences.First().ProjectInstance.FullPath}"); 585node.ProjectInstance.FullPath, 606var projectPath = node.ProjectInstance.FullPath; 636var projectPath = node.ProjectInstance.FullPath; 639var buildProjectInSolutionValue = node.ProjectInstance.GetPropertyValue("BuildProjectInSolution"); 644var projectDependencyValue = node.ProjectInstance.GetPropertyValue("ProjectDependency"); 698r => buildSession.BuildProjectFileAsync(r.ProjectInstance.FullPath, globalProperties: globalProperties)); 707.BuildProjectFile(rootNode.ProjectInstance.FullPath, globalProperties: globalProperties) 796mockLogger.FullLog.ShouldContain(string.Format(ResourceUtilities.GetResourceString("ProjectCacheQueryStartedWithDefaultTargets"), node.ProjectInstance.FullPath)); 800mockLogger.FullLog.ShouldContain(string.Format(ResourceUtilities.GetResourceString("ProjectCacheQueryStartedWithTargetNames"), node.ProjectInstance.FullPath, targets)); 805instanceMockCache.Requests.ShouldContain(r => r.ProjectFullPath.Equals(node.ProjectInstance.FullPath)); 811AssertBuildResultForCacheHit(node.ProjectInstance.FullPath, projectPathToBuildResults[node], expectedCacheResponse); 825mockLogger.FullLog.ShouldContain($"{AssemblyMockCache}: GetCacheResultAsync for {node.ProjectInstance.FullPath}"); 832private static int GetProjectNumber(ProjectGraphNode node) => GetProjectNumber(node.ProjectInstance.FullPath); 1428return buildSession.BuildProjectFileAsync(graph.ProjectNodes.First(n => GetProjectNumber(n) == projectNumber).ProjectInstance.FullPath); 1483node.ProjectInstance.FullPath, 1498buildSession.BuildProjectFile(graph.GraphRoots.First().ProjectInstance.FullPath).ShouldHaveSucceeded();
SolutionFileBuilder.cs (1)
96n => n.ProjectInstance.FullPath),
MSBuild (3)
XMake.cs (3)
1621nodeResultKvp.Key.ProjectInstance.FullPath.Equals(entryPoint.ProjectFile) && 1622nodeResultKvp.Key.ProjectInstance.GlobalProperties.Count == entryPoint.GlobalProperties.Count && 1623nodeResultKvp.Key.ProjectInstance.GlobalProperties.All(propertyKvp => entryPoint.GlobalProperties.TryGetValue(propertyKvp.Key, out string entryValue) &&