Exemple #1
0
        /// <summary>
        /// This method is used to execute the plug-in during the build process
        /// </summary>
        /// <param name="context">The current execution context</param>
        public void Execute(Utils.PlugIn.ExecutionContext context)
        {
            SandcastleProject project;
            string            workingPath;
            bool success;

            // Update shared content version items
            if (context.BuildStep == BuildStep.GenerateSharedContent)
            {
                this.UpdateVersionItems();
                return;
            }

            // Set the current version's reflection info filename and sort the
            // collection so that the versions are in ascending order.
            currentVersion.ReflectionFilename = builder.ReflectionInfoFilename;
            allVersions.Sort();

            // Merge the version information
            builder.ReportProgress("\r\nPerforming partial builds on prior version projects");

            // Build each of the projects
            foreach (VersionSettings vs in allVersions)
            {
                // Not needed for current project
                if (vs.HelpFileProject == null)
                {
                    continue;
                }

                project = new SandcastleProject(vs.HelpFileProject, true);

                // We'll use a working folder below the current project's working folder
                workingPath = builder.WorkingFolder +
                              vs.HelpFileProject.GetHashCode().ToString("X", CultureInfo.InvariantCulture) + "\\";

                success = this.BuildProject(project, workingPath);

                // Switch back to the original folder for the current project
                Directory.SetCurrentDirectory(builder.ProjectFolder);

                if (!success)
                {
                    throw new BuilderException("VBP0004", "Unable to build prior version project: " + project.Filename);
                }

                // Save the reflection file location as we need it later
                vs.ReflectionFilename = workingPath + "reflection.org";
            }

            // Create the Version Builder configuration and script file
            // and run it.
            builder.ReportProgress("\r\nCreating and running Version Builder script");
            builder.RunProcess(this.CreateVersionBuilderScript(), null);

            builder.ReportProgress("\r\nVersion information merged\r\n");
        }
        /// <summary>
        /// This method is used to execute the plug-in during the build process
        /// </summary>
        /// <param name="context">The current execution context</param>
        public void Execute(ExecutionContext context)
        {
            string workingPath;
            bool   success;

            // Update shared content version items
            if (context.BuildStep == BuildStep.GenerateSharedContent)
            {
                this.UpdateVersionItems();
                return;
            }

            // Set the current version's reflection info filename and sort the collection so that the versions
            // are in ascending order.
            currentVersion.ReflectionFilename = builder.ReflectionInfoFilename;
            allVersions.Sort();

            // Merge the version information
            builder.ReportProgress("\r\nPerforming partial builds on prior version projects");

            // Build each of the projects
            foreach (VersionSettings vs in allVersions)
            {
                // Not needed for current project
                if (vs.HelpFileProject != null)
                {
                    using (SandcastleProject project = new SandcastleProject(vs.HelpFileProject, true, true))
                    {
                        // We'll use a working folder below the current project's working folder
                        workingPath = builder.WorkingFolder + vs.HelpFileProject.GetHashCode().ToString("X",
                                                                                                        CultureInfo.InvariantCulture) + "\\";

                        success = this.BuildProject(project, workingPath);

                        // Switch back to the original folder for the current project
                        Directory.SetCurrentDirectory(builder.ProjectFolder);

                        if (!success)
                        {
                            throw new BuilderException("VBP0003", "Unable to build prior version project: " +
                                                       project.Filename);
                        }
                    }

                    // Save the reflection file location as we need it later
                    vs.ReflectionFilename = workingPath + "reflection.org";
                }
            }

            // Create the Version Builder configuration and add the parameters to the transform project
            this.CreateVersionBuilderConfigurationFile();
            this.ModifyTransformManifestProject();
        }
        /// <summary>
        /// This method is used to execute the plug-in during the build process
        /// </summary>
        /// <param name="context">The current execution context</param>
        public void Execute(ExecutionContext context)
        {
            string workingPath;
            bool   success;

            // Update shared content version items
            if (context.BuildStep == BuildStep.GenerateSharedContent)
            {
                this.UpdateVersionItems();
                return;
            }

            // Set the current version's reflection info filename and sort the collection so that the versions
            // are in ascending order.
            currentVersion.ReflectionFilename = builder.ReflectionInfoFilename;
            allVersions.Sort();

            // Merge the version information
            builder.ReportProgress("\r\nPerforming partial builds on prior version projects");

            // Build each of the projects
            foreach (VersionSettings vs in allVersions)
            {
                // Not needed for current project
                if (vs.HelpFileProject == null)
                {
                    continue;
                }

                using (SandcastleProject tempProject = new SandcastleProject(vs.HelpFileProject, true))
                {
                    // Set the configuration and platform here so that they are evaluated property in project
                    // properties when the project is loaded below.
                    tempProject.Configuration = builder.CurrentProject.Configuration;
                    tempProject.Platform      = builder.CurrentProject.Platform;

                    // This looks odd but is necessary.  If we are in Visual Studio, the above constructor may
                    // return an instance that uses an underlying MSBuild project loaded in Visual Studio.
                    // Since the BuildProject() method modifies the project, those changes are propagated to the
                    // Visual Studio copy which we do not want to happen.  As such, we use this constructor to
                    // clone the MSBuild project XML thus avoiding modifications to the original project.
                    using (SandcastleProject project = new SandcastleProject(tempProject))
                    {
                        // We'll use a working folder below the current project's working folder
                        workingPath = builder.WorkingFolder + vs.HelpFileProject.GetHashCode().ToString("X",
                                                                                                        CultureInfo.InvariantCulture) + "\\";

                        success = this.BuildProject(project, workingPath);

                        // Switch back to the original folder for the current project
                        Directory.SetCurrentDirectory(builder.ProjectFolder);

                        if (!success)
                        {
                            throw new BuilderException("VBP0003", "Unable to build prior version project: " +
                                                       project.Filename);
                        }
                    }
                }

                // Save the reflection file location as we need it later
                vs.ReflectionFilename = workingPath + "reflection.org";
            }

            // Create the Version Builder configuration and add the parameters to the transform project
            this.CreateVersionBuilderConfigurationFile();
            this.ModifyTransformManifestProject();
        }