internal ProjectItemGroupElement LookupItemGroup(string condition)
{
// look it up or create it.
var label = Pivots.GetExpressionLabel(condition);
ProjectItemGroupElement itemGroup;
if(string.IsNullOrEmpty(condition)) {
itemGroup = Xml.ItemGroups.FirstOrDefault(each => string.IsNullOrEmpty(each.Label));
if(itemGroup != null) {
return itemGroup;
}
}
else {
itemGroup = Xml.ItemGroups.FirstOrDefault(each => label == each.Label);
if(itemGroup != null) {
return itemGroup;
}
}
itemGroup = Xml.AddItemGroup();
if(!string.IsNullOrEmpty(condition)) {
itemGroup.Label = label;
itemGroup.Condition = Pivots.GetMSBuildCondition(Name, condition);
}
return itemGroup;
}