/// <summary> /// This is used to clone an existing project in order to build it without affecting the existing /// project's properties. /// </summary> /// <param name="cloneProject">The project to clone</param> /// <remarks>This is used to perform partial builds where we may want to use alternate property values.</remarks> public SandcastleProject(SandcastleProject cloneProject) : this() { string newName = Guid.NewGuid().ToString(); cloneProject.EnsureProjectIsCurrent(false); usingFinalValues = true; using(StringReader sr = new StringReader(cloneProject.msBuildProject.Xml.RawXml)) { using(XmlReader xr = XmlReader.Create(sr)) { msBuildProject = new Project(xr); } } // Use the same folder so that relative paths have the same base location. Use a different filename // to prevent the cloned instance from being unloaded by the build engine. msBuildProject.FullPath = Path.Combine(Path.GetDirectoryName(cloneProject.Filename), newName + ".shfbproj"); this.Configuration = cloneProject.Configuration; this.Platform = cloneProject.Platform; if(!String.IsNullOrEmpty(cloneProject.MSBuildOutDir)) this.MSBuildOutDir = cloneProject.MSBuildOutDir; this.LoadProperties(); }
/// <summary> /// This is used to clone an existing project in order to build it /// without affecting the existing project's properties. /// </summary> /// <param name="cloneProject">The project to clone</param> /// <param name="useFinalValues">True to load final values (i.e. for /// build) or false to load design-time values.</param> /// <remarks>This is used to perform partial builds where we may want /// to use alternate property values.</remarks> public SandcastleProject(SandcastleProject cloneProject, bool useFinalValues) : this() { string newName = Guid.NewGuid().ToString(); msBuildProject = new Project(Engine.GlobalEngine); usingFinalValues = useFinalValues; cloneProject.EnsureProjectIsCurrent(false); msBuildProject.LoadXml(cloneProject.MSBuildProject.Xml); // Use the same folder so that relative paths have the same // base location. Use a different filename to prevent the // cloned instance from being unloaded by the build engine. msBuildProject.FullFileName = Path.Combine( Path.GetDirectoryName(cloneProject.Filename), newName + ".shfbproj"); this.Configuration = cloneProject.Configuration; this.Platform = cloneProject.Platform; this.LoadProperties(); }