Q:

Custom MsBuild task: which solution/other projects are participating in the build? 

Is it possible to tell from an MsBuild custom task which solution the project is being built from, or which other projects are also participating in the build? 
Edit:
Trying to clarify the context a bit. 
Let's say I have the following setup:
Company
 +- LibA
     +- LibA.csproj
 +- LibB
     +- LibB.csproj
 +- App1
     +- App1.sln : App1.csproj, LibA.csproj, LibB.csproj
     +- App1.csproj
 +- App2
     +- App2.sln : App2.csproj, LibA.csproj
     +- App2.csproj

So as you can see both App1 and App2 use LibA and include it in the solution.  However LibB is only present in one solution. 
Now let's assume that there is a certain relationship between LibA and LibB and that this relationship is handled with a custom MsBuild task inside LibA/LibA.csproj.  However, to do this the custom task needs to know if LibB participated in the current build or not, or alternatively if it is present in the current solution or not.  Bear in mind it's the same csproj file used in both solutions. 
I don't mind doing it automatically or by adding meta-data to the .sln file. 
Is there a way to achieve this? 

A:

You could parse the .sln for csprojs (harder since its not xml), but you could parse the csproj for references and dependencies. 
Here is some example code (that might go into your custom task. 
    string fileName = @"C:\MyFolder\MyProjectFile.csproj";

    XDocument xDoc = XDocument. Load(fileName);

    XNamespace ns = XNamespace. Get("http://schemas.microsoft.com/developer/msbuild/2003");

    //References "By DLL (file)"
    var list1 = from list in xDoc. Descendants(ns + "ItemGroup")
                from item in list. Elements(ns + "Reference")
                /* where item. Element(ns + "HintPath") ! = null */
            select new
               {
                   CsProjFileName = fileName,
                   ReferenceInclude = item. Attribute("Include").Value,
                   RefType = (item. Element(ns + "HintPath") == null) ? " CompiledDLLInGac" : "CompiledDLL",
                   HintPath = (item. Element(ns + "HintPath") == null) ?  string. Empty : item. Element(ns + "HintPath").Value
               };

    foreach (var v in list1)
    {
        Console. WriteLine(v. ToString());
    }

    //References "By Project"
    var list2 = from list in xDoc. Descendants(ns + "ItemGroup")
                from item in list. Elements(ns + "ProjectReference")
                where
                item. Element(ns + "Project") ! = null
                select new
                {
                    CsProjFileName = fileName,
                    ReferenceInclude = item. Attribute("Include").Value,
                    RefType = "ProjectReference",
                    ProjectGuid = item. Element(ns + "Project").Value
                };

    foreach (var v in list2)
    {
        Console. WriteLine(v. ToString());
    }

