コード例 #1
0
 public MultiReference(string source, MultiReferenceType type)
 {
     if (type == MultiReferenceType.Assembly)
     {
         AssemblySource = source;
     }
     else
     {
         ProjectSource  = source;
         AssemblySource = SolutionParser.GetAssemblyNameFromProject(ProjectSource);
     }
     this.Type = type;
 }
コード例 #2
0
        static IEnumerable <MultiReference> ChangeVersion(IDteWrapper dte, ProjectType projectType, string newVersion)
        {
            var assemblyReferences = dte.GetReferences(x => x.Name.Contains("DevExpress")).Select(x => new MultiReference(x.Name, MultiReferenceType.Assembly).Do(mr => mr.ReplaceVersion(newVersion)));
            var projectReferences  = dte.GetProjects(x => x.Name.Contains("DevExpress")).Select(x => new MultiReference(x.FullName, MultiReferenceType.Project).Do(mr => mr.ReplaceVersion(newVersion)));

            var assemplyReferenceNames = assemblyReferences.Select(x => x.AssemblySource);
            var projectReferenceNames  = projectReferences.Select(x => x.AssemblySource);

            var model = SerializeHelper.DeSerializeNavigationConfig();

            var projects       = model.NavigateItems.Where(x => x.GeneratedProjects != null).SelectMany(x => x.GeneratedProjects).Distinct();
            var targetProjects = projects.Select(x => new MultiReference(x, MultiReferenceType.Project)).Where(project => {
                var projectRoot = ProjectRootElement.Open(project.ProjectSource);
                if (project.ProjectSource.Contains("Localization") || SolutionParser.GetProjectType(projectRoot).Conflicts(projectType))
                {
                    return(false);
                }
                var assemblyNameProperty = SolutionParser.GetAssemblyNameFromProject(projectRoot).If(DXControlsVersionHelper.HasDXVersionInfo);
                if (assemblyNameProperty == null)
                {
                    return(false);
                }
                if (projectReferenceNames.Contains(assemblyNameProperty))
                {
                    project.Type = MultiReferenceType.Project;
                    return(true);
                }
                if (assemplyReferenceNames.Contains(assemblyNameProperty))
                {
                    project.Type = MultiReferenceType.Assembly;
                    return(true);
                }
                return(false);
            }).ToList();
            var dependentProjects = targetProjects.SelectMany(x => SolutionParser.GetDXReferencePaths(x.ProjectSource, true)).Where(x => !ReferenceInfo.IsEmpty(x)).Select(x => new MultiReference(x)).ToList();

            return(Concat(targetProjects.ToList(), dependentProjects.ToList()).Distinct());
        }