/// <summary>
        /// Retrieves the list of source file names from the specified project.
        /// </summary>
        /// <param name="projectPath">Full path to the project file.</param>
        /// <returns>A non-null (but possibly empty) list of full paths to files.</returns>
        internal IEnumerable <string> LoadSourceFilesFromProject(string projectPath)
        {
            IEnumerable <string> sources = new string[0];
            Project project = this.LoadProject(projectPath);

            if (project == null)
            {
                return(sources);
            }

            // Tell the user.  This helps us see when we use the cache and when we don't
            this._logger.LogMessage(string.Format(CultureInfo.CurrentCulture, Resource.Analyzing_Project_Files, Path.GetFileName(projectPath)));

#if NET40
            sources = project.GetItems("Compile").Select(i => ConvertToFullPath(i.EvaluatedInclude, projectPath));
#else
            BuildItemGroup buildItemGroup = project.GetEvaluatedItemsByName("Compile");
            if (buildItemGroup != null)
            {
                sources = buildItemGroup.OfType <BuildItem>().Select(b => ConvertToFullPath(b.FinalItemSpec, projectPath));
            }
#endif
            return(sources);
        }
        /// <summary>
        /// Returns the list of all project references found in the given <paramref name="projectPath"/>
        /// </summary>
        /// <remarks>
        /// This method unconditionally opens an MSBuild object model on the given project
        /// to extract the set of project references.  It does not cache.  Use with care.
        /// </remarks>
        /// <param name="projectPath">Full path to the project to open.</param>
        /// <returns>The list of full project file names referred by by the given project.</returns>
        internal IEnumerable <string> LoadProjectReferences(string projectPath)
        {
            IEnumerable <string> projects = new string[0];

            Project project = this.LoadProject(projectPath);

            if (project == null)
            {
                return(projects);
            }

            this._logger.LogMessage(string.Format(CultureInfo.CurrentCulture, Resource.Analyzing_Project_References, Path.GetFileName(projectPath)));

#if NET40
            projects = project.GetItems("ProjectReference").Select(i => ConvertToFullPath(i.EvaluatedInclude, projectPath));
#else
            BuildItemGroup buildItemGroup = project.GetEvaluatedItemsByName("ProjectReference");
            if (buildItemGroup != null)
            {
                projects = buildItemGroup.OfType <BuildItem>().Select(b => ConvertToFullPath(b.FinalItemSpec, projectPath));
            }
#endif
            // Tell the user what project references we found
            if (projects.Any())
            {
                StringBuilder sb = new StringBuilder(string.Format(CultureInfo.CurrentCulture, Resource.Project_References_Found, Path.GetFileName(projectPath)));
                foreach (string p in projects)
                {
                    sb.AppendLine();
                    sb.Append("    " + p);
                }
                this._logger.LogMessage(sb.ToString());
            }

            return(projects);
        }