public void ConstructWithMultipleEntryPointsWithDifferentGlobalPropertiesConverging() { using (var env = TestEnvironment.Create()) { TransientTestFile entryProject = env.CreateFile("1.proj", @" <Project> <ItemGroup> <ProjectReference Include=""2.proj"" GlobalPropertiesToRemove=""Platform"" /> </ItemGroup> </Project>"); CreateProjectFile(env, 2); var entryPoint1 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary <string, string> { { "Platform", "x86" } }); var entryPoint2 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary <string, string> { { "Platform", "x64" } }); var projectGraph = new ProjectGraph(new[] { entryPoint1, entryPoint2 }); projectGraph.ProjectNodes.Count.ShouldBe(3); projectGraph.EntryPointNodes.Count.ShouldBe(2); var entryPointNode1 = projectGraph.EntryPointNodes.First(); var entryPointNode2 = projectGraph.EntryPointNodes.Last(); // The entry points should not be the same node, but should point to the same project entryPointNode1.ShouldNotBe(entryPointNode2); entryPointNode1.ProjectInstance.FullPath.ShouldBe(entryPointNode2.ProjectInstance.FullPath); entryPointNode1.GlobalProperties["Platform"].ShouldBe("x86"); entryPointNode2.GlobalProperties["Platform"].ShouldBe("x64"); // The entry points should have the same project reference since they're platform-agnostic entryPointNode1.ProjectReferences.Count.ShouldBe(1); entryPointNode2.ProjectReferences.Count.ShouldBe(1); entryPointNode1.ProjectReferences.First().ShouldBe(entryPointNode2.ProjectReferences.First()); entryPointNode1.ProjectReferences.First().GlobalProperties.ContainsKey("Platform").ShouldBeFalse(); } }
public void ConstructWithMultipleEntryPointsWithDifferentGlobalProperties() { using (var env = TestEnvironment.Create()) { TransientTestFile entryProject = CreateProjectFile(env, 1, new[] { 2 }); CreateProjectFile(env, 2); var entryPoint1 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary <string, string> { { "Platform", "x86" } }); var entryPoint2 = new ProjectGraphEntryPoint(entryProject.Path, new Dictionary <string, string> { { "Platform", "x64" } }); var projectGraph = new ProjectGraph(new[] { entryPoint1, entryPoint2 }); projectGraph.ProjectNodes.Count.ShouldBe(4); projectGraph.EntryPointNodes.Count.ShouldBe(2); var entryPointNode1 = projectGraph.EntryPointNodes.First(); var entryPointNode2 = projectGraph.EntryPointNodes.Last(); // The entry points should not be the same node, but should point to the same project entryPointNode1.ShouldNotBe(entryPointNode2); entryPointNode1.ProjectInstance.FullPath.ShouldBe(entryPointNode2.ProjectInstance.FullPath); entryPointNode1.GlobalProperties["Platform"].ShouldBe("x86"); entryPointNode2.GlobalProperties["Platform"].ShouldBe("x64"); // The entry points should not have the same project reference, but should point to the same project reference file entryPointNode1.ProjectReferences.Count.ShouldBe(1); entryPointNode2.ProjectReferences.Count.ShouldBe(1); entryPointNode1.ProjectReferences.First().ShouldNotBe(entryPointNode2.ProjectReferences.First()); entryPointNode1.ProjectReferences.First().ProjectInstance.FullPath.ShouldBe(entryPointNode2.ProjectReferences.First().ProjectInstance.FullPath); entryPointNode1.ProjectReferences.First().GlobalProperties["Platform"].ShouldBe("x86"); entryPointNode2.ProjectReferences.First().GlobalProperties["Platform"].ShouldBe("x64"); } }
/// <summary> /// Constructs a GraphBuildRequestData for build requests based on a project graph entry points. /// </summary> /// <param name="projectGraphEntryPoint">The entry point to use in the build.</param> /// <param name="targetsToBuild">The targets to build.</param> /// <param name="hostServices">The host services to use, if any. May be null.</param> public GraphBuildRequestData(ProjectGraphEntryPoint projectGraphEntryPoint, ICollection <string> targetsToBuild, HostServices hostServices) : this(projectGraphEntryPoint.AsEnumerable(), targetsToBuild, hostServices, BuildRequestDataFlags.None) { }