Exemplo n.º 1
0
        /// <summary>
        /// Reads all the source files and references from the given list of projects.
        /// </summary>
        /// <param name="projectFiles">The list of projects to analyse.</param>
        void AnalyseProjectFiles(FileInfo[] projectFiles)
        {
            progressMonitor.AnalysingProjectFiles(projectFiles.Count());

            foreach (var proj in projectFiles)
            {
                try
                {
                    var csProj = new CsProjFile(proj);

                    foreach (var @ref in csProj.References)
                    {
                        AssemblyInfo resolved = assemblyCache.ResolveReference(@ref);
                        if (!resolved.Valid)
                        {
                            UnresolvedReference(@ref, proj.FullName);
                        }
                        else
                        {
                            UseReference(resolved.Filename);
                        }
                    }

                    foreach (var src in csProj.Sources)
                    {
                        // Make a note of which source files the projects use.
                        // This information doesn't affect the build but is dumped
                        // as diagnostic output.
                        UseSource(new FileInfo(src));
                    }
                    ++succeededProjects;
                }
                catch (Exception ex)
                {
                    ++failedProjects;
                    progressMonitor.FailedProjectFile(proj.FullName, ex.Message);
                }
            }
        }