Exemple #1
0
        /// <summary>
        /// This constructor creates a scope for a particular name and set of properties
        /// </summary>
        internal CacheScope(string scopeName, BuildPropertyGroup scopeProperties, string scopeToolsVersion)
        {
            // Make certain we don't cache a reference to a Project object, which would defeat
            // the purpose of this cache
            scopeProperties.ClearParentProject();

            this.scopeName         = scopeName;
            this.scopeToolsVersion = scopeToolsVersion;
            this.scopeProperties   = scopeProperties;
            this.cacheContents     = new Hashtable(StringComparer.OrdinalIgnoreCase);
        }
Exemple #2
0
 /// <summary>
 /// This constructor creates a scope for a particular name and set of properties
 /// </summary>
 internal CacheScope(string scopeName, BuildPropertyGroup scopeProperties, string scopeToolsVersion)
 {
     // Make certain we don't cache a reference to a Project object, which would defeat 
     // the purpose of this cache
     scopeProperties.ClearParentProject(); 
     
     this.scopeName = scopeName;
     this.scopeToolsVersion = scopeToolsVersion;
     this.scopeProperties = scopeProperties;
     this.cacheContents = new Hashtable(StringComparer.OrdinalIgnoreCase);
 }
Exemple #3
0
        /// <summary>
        /// Removes a &lt;PropertyGroup&gt; from the main project file.
        /// </summary>
        /// <param name="propertyGroupToRemove"></param>
        public void RemoveImportedPropertyGroup
        (
            BuildPropertyGroup propertyGroupToRemove
        )
        {
            error.VerifyThrowArgumentNull(propertyGroupToRemove, "propertyGroupToRemove");

            // Confirm that it's actually a persisted BuildPropertyGroup in the current project.
            error.VerifyThrowInvalidOperation(
                (propertyGroupToRemove.ParentProject == this) && (propertyGroupToRemove.PropertyGroupElement != null),
                "IncorrectObjectAssociation", "BuildPropertyGroup", "Project");

            // Clear out the children of the property group.
            propertyGroupToRemove.ClearImportedPropertyGroup();

            ErrorUtilities.VerifyThrow(propertyGroupToRemove.ParentCollection != null, "Why doesn't this PG have a parent collection?");
            propertyGroupToRemove.ParentCollection.RemovePropertyGroup(propertyGroupToRemove);

            propertyGroupToRemove.ClearParentProject();

            this.MarkProjectAsDirtyForReevaluation();
        }
Exemple #4
0
        /// <summary>
        /// Removes a &lt;PropertyGroup&gt; from the main project file.
        /// </summary>
        /// <param name="propertyGroupToRemove"></param>
        /// <owner>RGoel</owner>
        public void RemovePropertyGroup
        (
            BuildPropertyGroup propertyGroupToRemove
        )
        {
            error.VerifyThrowArgumentNull(propertyGroupToRemove, "propertyGroupToRemove");

            // Confirm that it's not an imported property group.
            error.VerifyThrowInvalidOperation(!propertyGroupToRemove.IsImported,
                "CannotModifyImportedProjects");

            // Confirm that it's actually a persisted BuildPropertyGroup in the current project.
            error.VerifyThrowInvalidOperation(
                (propertyGroupToRemove.ParentProject == this) && (propertyGroupToRemove.PropertyGroupElement != null),
                "IncorrectObjectAssociation", "BuildPropertyGroup", "Project");

            // Clear out the children of the property group.
            propertyGroupToRemove.Clear();

            XmlElement parentElement = propertyGroupToRemove.ParentElement;
            ErrorUtilities.VerifyThrow(parentElement != null, "Why doesn't this PG have a parent XML element?");
            parentElement.RemoveChild(propertyGroupToRemove.PropertyGroupElement);

            ErrorUtilities.VerifyThrow(propertyGroupToRemove.ParentCollection != null, "Why doesn't this PG have a parent collection?");
            propertyGroupToRemove.ParentCollection.RemovePropertyGroup(propertyGroupToRemove);

            propertyGroupToRemove.ClearParentProject();

            this.MarkProjectAsDirty();
        }