public List <MSBProject> GetProjects(bool useGlobalProps = true) { if (msprojectCollection == null) { msprojectCollection = ProjectCollection.GlobalProjectCollection; } msprojectCollection.UnloadAllProjects(); var csfileList = Directory.EnumerateFiles(inputDir, "*.csproj", SearchOption.AllDirectories).AsParallel(); var vcfileList = Directory.EnumerateFiles(inputDir, "*.vcxproj", SearchOption.AllDirectories).AsParallel(); var fileList = csfileList.Concat(vcfileList); CountFoundFiles = fileList.Count(); ConcurrentBag <MSBProject> bag = new ConcurrentBag <MSBProject>(); Parallel.ForEach(fileList, (file) => { try { MSBProject p = null; if (useGlobalProps) { p = new MSBProject(file, _globalProperties, toolsVersion); } else { p = new MSBProject(file, toolsVersion); } bag.Add(p); msprojectCollection.LoadProject(p.FullPath); } catch (Exception e) { Utils.WL(ConsoleColor.Red, String.Format("Bad File: {0}", file)); Utils.WL(ConsoleColor.DarkGray, e.Message); } }); var sorted = from proj in bag orderby proj.FullPath select proj; return(sorted.ToList()); }
private void GetPropertiesFor(MSBProject project) { foreach (ProjectProperty prop in project.AllEvaluatedProperties) { if (!prop.IsImported && !prop.IsEnvironmentProperty && !prop.IsReservedProperty) { string key = prop.Name; if (_allFoundProperties.ContainsKey(key)) { _allFoundProperties[key].Add(project); } else { _allFoundProperties[key] = new ReferencedProperty(prop, project) { UsedCount = 1 }; } } } }
/// <summary> /// Constructor. /// </summary> /// <param name="prop">A property instance from the project</param> public ReferencedProperty(ProjectProperty prop, MSBProject proj) { this.Name = prop.Name; _projects.Add(proj); }
public void AddProject(MSBProject p) { Count++; _projects.Add(p); }
public ReferencedValues(MSBProject proj) { _projects.Add(proj); Count++; }
public void Add(MSBProject proj) { _projects.Add(proj); UsedCount++; }