internal ProjectItemDefinitionGroupElement LookupItemDefinitionGroup(string condition)
{
// look it up or create it.
var label = Pivots.GetExpressionLabel(condition);
if(string.IsNullOrEmpty(condition)) {
var result = Xml.ItemDefinitionGroups.FirstOrDefault(each => string.IsNullOrEmpty(each.Label));
if(result != null) {
return result;
}
}
else {
var result = Xml.ItemDefinitionGroups.FirstOrDefault(each => label == each.Label);
if(result != null) {
return result;
}
}
var idg = Xml.AddItemDefinitionGroup();
if(!string.IsNullOrEmpty(condition)) {
idg.Label = label;
idg.Condition = Pivots.GetMSBuildCondition(Name, condition);
}
return idg;
}