Esempio n. 1
0
        /// <summary>
        /// Sets or removes an attribute from the target element. Marks the target dirty after the update
        /// </summary>
        /// <param name="attributeName"></param>
        /// <param name="attributeValue"></param>
        /// <returns>XmlAttribute which has been updated</returns>
        internal XmlAttribute SetOrRemoveTargetAttribute
            (
            string attributeName,
            string attributeValue
            )
        {
            // If this Target object is not actually represented by a 
            // <Target> element in the parentProject.file, then do not allow
            // the caller to set the condition.
            error.VerifyThrowInvalidOperation(this.targetElement != null, "CannotSetCondition");

            // If this item was imported from another parentProject. we don't allow modifying it.
            error.VerifyThrowInvalidOperation(!this.importedFromAnotherProject, "CannotModifyImportedProjects");

            XmlAttribute updatedAttribute = ProjectXmlUtilities.SetOrRemoveAttribute(targetElement, attributeName, attributeValue);

            // Mark the project dirty after an attribute has been updated
            this.MarkTargetAsDirty();

            return updatedAttribute;
        }