internal ProjectItemElement LookupItem(ProjectItemGroupElement parent, string name, string condition = null)
{
ProjectItemElement property = null;
var label = Pivots.GetExpressionLabel(condition);
name = name.Replace(".", "_");
if(string.IsNullOrEmpty(condition)) {
property = parent.Items.FirstOrDefault(each => name == each.ItemType && string.IsNullOrEmpty(each.Condition));
if(property != null) {
return property;
}
return parent.AddItem(name, "UNUSED");
}
var conditionExpression = Pivots.GetMSBuildCondition(Name, condition);
property = parent.Items.FirstOrDefault(each => name == each.ItemType && each.Condition == conditionExpression);
if(property != null) {
return property;
}
property = parent.AddItem(name, "UNUSED");
property.Label = label;
property.Condition = conditionExpression;
return property;
}