示例#1
0
        public async Task <Project> AnalyzeProject(string csProjPath, List <string> projectReferenceNamesToIgnore = null)
        {
            var doc = new XmlDocument();

            var fileInfo = new FileInfo(csProjPath);

            doc = await _fileUtilities.ReadXmlDocument(fileInfo);

            if (doc != null)
            {
                projectReferenceNamesToIgnore = projectReferenceNamesToIgnore == null ? new List <string>() : projectReferenceNamesToIgnore;

                var project = new Project();
                project.ProjectReferences = new ProjectReferenceList();

                project.Name = fileInfo.Name;
                project.Path = fileInfo.FullName;

                var packageList = await GetPackageFile(doc, fileInfo.DirectoryName);

                project.Packages = packageList;
                project.ProjectReferences.AddRange(await GetReferences(doc, projectReferenceNamesToIgnore, project, packageList, fileInfo.DirectoryName));
                project.ProjectReferences.AddRange(await GetPackageReferences(doc, projectReferenceNamesToIgnore, project, packageList, fileInfo.DirectoryName));
                project.ProjectReferences.AddRange(GetProjectReferences(doc, projectReferenceNamesToIgnore, project));

                return(project);
            }

            return(null);
        }