Exemplo n.º 1
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();
        }