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