Esempio n. 1
0
        private void ConvertProjectsToBuild(XDocument project, SortedProjects projects, string toolsVersion, bool silverlight)
        {
            if (projects.SortedList.Count == 0) return;

            XElement itemGroup = CreateItemGroup();

            foreach (var p in projects.SortedList)
            {

                XElement projectToBuild = CreateItem("ProjectToBuild",
                    string.Format(CultureInfo.InvariantCulture, "$(DevExpressSourceDir)\\{0}", Utils.MakeRelativePath(SourceCodeDir, p.FullPath)));

                if (!SkipFrameworkVersion)
                {
                    if (silverlight)
                        projectToBuild.Add(new XElement("SL", "True"));
                    else
                        projectToBuild.Add(new XElement("FrameworkVersion", GetFrameworkVersion(p)));
                }
                if (!string.IsNullOrWhiteSpace(toolsVersion))
                    projectToBuild.Add(new XElement("ToolsVersion", toolsVersion));

                itemGroup.Add(projectToBuild);
            }


            project.Root.Add(itemGroup);

        }
Esempio n. 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) &&
                    !pi.IsUwp && !pi.IsCodedUITests)
                {

                    Project p = TryOpenProject(projectFile);
                    //TODO: Get rid of hard-coded exclusions
                    if (p != null && !p.GetAssemblyName().Contains("SharePoint"))
                    {
                        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>"));
        }
Esempio n. 3
0
        private void ConvertProjectsToBuild(XDocument project, SortedProjects projects, string toolsVersion, bool silverlight)
        {
            if (projects.SortedList.Count == 0) return;

            XElement itemGroup = CreateItemGroup();

            foreach (var p in projects.SortedList)
            {

                XElement projectToBuild = CreateItem("ProjectToBuild",
                    string.Format(CultureInfo.InvariantCulture, "$(DevExpressSourceDir)\\{0}",  Utils.MakeRelativePath(SourceCodeDir, p.FullPath)));

                if (silverlight)
                    projectToBuild.Add(new XElement("SL", "True"));
                else
                {
                    projectToBuild.Add(new XElement("FrameworkVersion", GetFrameworkVersion(p)));
                }

                if (!string.IsNullOrWhiteSpace(toolsVersion))
                    projectToBuild.Add(new XElement("ToolsVersion", toolsVersion));

                itemGroup.Add(projectToBuild);
            }

            project.Root.Add(itemGroup);
        }
Esempio n. 4
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>"));
        }