public ProjectReferenceInfo(SolutionProject project)
        {
            this.ProjectName = project.ProjectName;
            this.RelativePath = project.RelativePath;

            ProjectReferences = new List<ReferenceDetails>();
            FrameworkReferences = new List<ReferenceDetails>();
            LibraryReferences = new List<ReferenceDetails>();
        }
        /// <summary>
        /// Gets all of the reference details for a given project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns>A ProjectReferenceInfo object.</returns>
        public static ProjectReferenceInfo GetReferenceDetailsForProject(SolutionProject project)
        {
            var projectReferenceInfo = new ProjectReferenceInfo(project);

            string projectFilePath = Path.GetFullPath(project.RelativePath);

            XmlDocument projectXml = new XmlDocument();

            projectXml.Load(projectFilePath);

            // set environment directory to the folder level so relative paths are accurate
            string projectFolderPath = Path.GetDirectoryName(projectFilePath);
            Environment.CurrentDirectory = projectFolderPath;

            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(projectXml.NameTable);
            namespaceManager.AddNamespace("ns1", "http://schemas.microsoft.com/developer/msbuild/2003");

            // Project References
            XmlNodeList nodeList = projectXml.SelectNodes("//ns1:ItemGroup/ns1:ProjectReference", namespaceManager);
            foreach (XmlNode node in nodeList)
            {
                ReferenceDetails details = GetReferenceDetails(node, ReferenceType.Project, namespaceManager);
                projectReferenceInfo.ProjectReferences.Add(details);
            }

            // Framework and Library References
            nodeList = projectXml.SelectNodes("//ns1:ItemGroup/ns1:Reference", namespaceManager);
            foreach (XmlNode node in nodeList)
            {
                ReferenceDetails details = GetReferenceDetails(node, ReferenceType.Unknown, namespaceManager);

                if (details.ReferenceType == ReferenceType.Framework)
                {
                    projectReferenceInfo.FrameworkReferences.Add(details);
                }
                else if (details.ReferenceType == ReferenceType.Library)
                {
                    projectReferenceInfo.LibraryReferences.Add(details);
                }
            }
            return projectReferenceInfo;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Solution"/> class.
        /// </summary>
        /// <param name="solutionFileName">Name of the solution file.</param>
        /// <exception cref="System.InvalidOperationException">Can not find type 'Microsoft.Build.Construction.SolutionParser' are you missing a assembly reference to 'Microsoft.Build.dll'?</exception>
        public Solution(string solutionFileName)
        {
            if (!string.IsNullOrEmpty(Path.GetDirectoryName(solutionFileName)))
            {
                Environment.CurrentDirectory = Path.GetDirectoryName(solutionFileName);
            }

            if (_SolutionParser == null)
            {
                throw new InvalidOperationException("Can not find type 'Microsoft.Build.Construction.SolutionParser' are you missing a assembly reference to 'Microsoft.Build.dll'?");
            }
            var solutionParser = _SolutionParser.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).First().Invoke(null);
            using (var streamReader = new StreamReader(solutionFileName))
            {
                _SolutionParser_solutionReader.SetValue(solutionParser, streamReader, null);
                _SolutionParser_ParseSolution.Invoke(solutionParser, null);
            }

            //// debug info to show what methods and properties are available
            ////MethodInfo[] methodInfos = s_SolutionParser.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic);
            ////List<string> methodInformation = methodInfos.Select(method => string.Format("{0}~{1}~{2}", method.MemberType.ToString(), method.Name, method.ReturnType.ToString())).ToList();
            ////string typeInformation = string.Join(Environment.NewLine, methodInformation);
            ////PropertyInfo[] propertyInfos = s_SolutionParser.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic);
            ////List<string> propertyInformation = propertyInfos.Select(property => string.Format("{0}~{1}~{2}", property.MemberType.ToString(), property.Name, property.PropertyType.ToString())).ToList();
            ////typeInformation += string.Join(Environment.NewLine, propertyInformation);

            var projects = new List<SolutionProject>();
            var array = (Array)_SolutionParser_Projects.GetValue(solutionParser, null);

            for (int i = 0; i < array.Length; i++)
            {
                SolutionProject project = new SolutionProject(array.GetValue(i));
                string projectFilePath = Path.GetFullPath(project.RelativePath);

                if (File.Exists(projectFilePath))
                {
                    projects.Add(project);
                }
            }
            this.Projects = projects;
        }