/// <summary> /// Convenience method that picks a location based on a heuristic: /// Adds a new property after the last property in this property group. /// </summary> public ProjectPropertyElement AddProperty(string name, string unevaluatedValue) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue)); ProjectPropertyElement newProperty = ContainingProject.CreatePropertyElement(name); newProperty.Value = unevaluatedValue; AppendChild(newProperty); return(newProperty); }
/// <summary> /// Parse a ProjectPropertyGroupElement from the element /// </summary> private ProjectPropertyGroupElement ParseProjectPropertyGroupElement(XmlElementWithLocation element, ProjectElementContainer parent) { ProjectXmlUtilities.VerifyThrowProjectAttributes(element, ValidAttributesOnlyConditionAndLabel); ProjectPropertyGroupElement propertyGroup = new ProjectPropertyGroupElement(element, parent, _project); foreach (XmlElementWithLocation childElement in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element)) { ProjectXmlUtilities.VerifyThrowProjectAttributes(childElement, ValidAttributesOnlyConditionAndLabel); XmlUtilities.VerifyThrowProjectValidElementName(childElement); ProjectErrorUtilities.VerifyThrowInvalidProject(!XMakeElements.ReservedItemNames.Contains(childElement.Name) && !ReservedPropertyNames.IsReservedProperty(childElement.Name), childElement.Location, "CannotModifyReservedProperty", childElement.Name); // All children inside a property are ignored, since they are only part of its value ProjectPropertyElement property = new ProjectPropertyElement(childElement, propertyGroup, _project); propertyGroup.AppendParentedChildNoChecks(property); } return(propertyGroup); }