[xbuild] Emit list of projects in the .sln.proj
authorAnkit Jain <radical@corewars.org>
Fri, 11 Mar 2011 09:03:32 +0000 (14:33 +0530)
committerAnkit Jain <radical@corewars.org>
Fri, 11 Mar 2011 13:16:20 +0000 (18:46 +0530)
Emit list of projects in the solution as @(ProjectReference) items
in the generated .sln.proj file. This would be useful for extending
solution builds.

mcs/tools/xbuild/SolutionParser.cs

index e59375a0df69fa299fd17cbcc4c9202e32ae8071..c86083d6685f320f3e5aaf1d11cf56c5346963c3 100644 (file)
@@ -304,6 +304,7 @@ namespace Mono.XBuild.CommandLine {
                        int num_levels = AddBuildLevels (p, solutionTargets, projectInfos, ref infosByLevel);
 
                        AddCurrentSolutionConfigurationContents (p, solutionTargets, projectInfos, websiteProjectInfos);
+                       AddProjectReferences (p, projectInfos);
                        AddWebsiteProperties (p, websiteProjectInfos, projectInfos);
                        AddValidateSolutionConfiguration (p);
 
@@ -487,6 +488,13 @@ namespace Mono.XBuild.CommandLine {
                        }
                }
 
+               void AddProjectReferences (Project p, Dictionary<Guid, ProjectInfo> projectInfos)
+               {
+                       BuildItemGroup big = p.AddNewItemGroup ();
+                       foreach (KeyValuePair<Guid, ProjectInfo> pair in projectInfos)
+                               big.AddNewItem ("ProjectReference", pair.Value.FileName);
+               }
+
                void AddProjectConfigurationItems (Guid guid, ProjectInfo projectInfo, TargetInfo solutionTarget,
                                StringBuilder solutionConfigurationContents)
                {