コード例 #1
0
 public void Add(Project project)
 {
     projects.Add(project.GetAssemblyName(), project);
 }
コード例 #2
0
        internal void Generate()
        {
            XDocument project = XDocument.Load(TemplateFileName);

            string[] projectFiles = Directory.GetFiles(SourceCodeDir, "*.csproj", SearchOption.AllDirectories);

            vsShellAssembly = GetMicrosoftVisualStudioShellAssembly();

            var silverlightProjects = new SortedProjects();
            var windowsProjects = new SortedProjects();

            if (!string.IsNullOrWhiteSpace(OutputPath))
                SetPropertyValue(project, "OutputPath", OutputPath);

            SetPropertyValue(project, "DevExpressSourceDir", SourceCodeDir);
            SetPropertyValue(project, "TasksAssembly", GetType().Assembly.Location);

            foreach (var projectFile in projectFiles)
            {
                bool added = false;

                ProjectInfo pi = GetProjectInfo(projectFile);
                if (!(pi.IsSilverlight && SkipSilverlightProjects) &&
                    !(pi.IsTest && SkipTestProjects) &&
                    !(pi.IsMvc && SkipMvcProjects) &&
                    !(pi.IsWinRT && SkipWinRTProjects))
                {

                    Project p = new Project(projectFile);
                    //TODO: Get rid of hard-coded exclusions
                    if (!p.GetAssemblyName().Contains("SharePoint") && !p.FullPath.Contains("DevExpress.Xpo.Extensions.csproj"))
                    {
                        if (pi.IsSilverlight)
                        {
                            if (!p.FullPath.Contains(".DemoBase."))
                            {
                                silverlightProjects.Add(p);
                                added = true;
                            }
                        }
                        else
                        {
                            windowsProjects.Add(p);
                            if (p.GetPropertyValue("OutputType") == "Library")
                                libraryAssemblyNames.Add(p.GetAssemblyName());
                            added = true;
                        }
                    }
                }

                if (!added)
                {

                    if (!pi.IsSilverlight)
                        windowsProjects.AddExcluded(pi.AssemblyName);
                }

            }

            silverlightProjects.Sort();
            windowsProjects.Sort();

            foreach (var p in windowsProjects.SortedList)
                UpdateProjectReferences(p);

            referenceFiles.Clear();
            PopulateReferenceFiles(silverlightProjects.UnknownReferences);
            PopulateReferenceFiles(windowsProjects.UnknownReferences);
            referenceFiles.Add(typeof(System.Data.Entity.DbContext).Assembly.Location);
            string xamlResProcDll = Directory.GetFiles(ReferencesPath, "DevExpress.Build.XamlResourceProcessing*.dll", SearchOption.AllDirectories).FirstOrDefault();
            if (!string.IsNullOrEmpty(xamlResProcDll))
            {
                referenceFiles.Add(xamlResProcDll);
                ConvertTargetFiles(
                    Path.Combine(@"$(BuildTasksPath)", Path.GetFileName(xamlResProcDll)));
            }
            else
                Console.WriteLine("WARNING: DevExpress.Build.XamlResourceProcessing not found.");

            CreateReferenceFilesGroup(project);
            ConvertPatchInternals(project);

            ConvertProjectsToBuild(project, silverlightProjects, "4.0", true);
            ConvertProjectsToBuild(project, windowsProjects, "4.0", false);
            CreateAssemblyNamesItems(project);

            File.WriteAllText(OutputFileName, project.ToString().Replace("<ItemGroup xmlns=\"\">", "<ItemGroup>"));
        }