Browse Source

Fix SD-1718 - Post build events not added to end of project file.

pull/14/head
Matt Ward 15 years ago
parent
commit
e1cc2ab2e4
  1. 44
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

44
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -839,18 +839,50 @@ namespace ICSharpCode.SharpDevelop.Project @@ -839,18 +839,50 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
}
foreach (var propertyGroup in targetProject.PropertyGroups) {
if (propertyGroup.Condition == groupCondition) {
propertyGroup.AddProperty(propertyName, newValue);
return;
}
var matchedPropertyGroup = FindPropertyGroup(targetProject, groupCondition, position);
if (matchedPropertyGroup != null) {
matchedPropertyGroup.AddProperty(propertyName, newValue);
return;
}
var newGroup = targetProject.AddPropertyGroup();
var newGroup = AddNewPropertyGroup(targetProject, position);
newGroup.Condition = groupCondition;
newGroup.AddProperty(propertyName, newValue);
}
ProjectPropertyGroupElement FindPropertyGroup(ProjectRootElement targetProject, string groupCondition, PropertyPosition position)
{
ProjectPropertyGroupElement matchedPropertyGroup = null;
foreach (var projectItem in targetProject.Children) {
ProjectPropertyGroupElement propertyGroup = projectItem as ProjectPropertyGroupElement;
if (propertyGroup != null) {
if (propertyGroup.Condition == groupCondition) {
matchedPropertyGroup = propertyGroup;
if (position != PropertyPosition.UseExistingOrCreateAfterLastImport) {
return matchedPropertyGroup;
}
}
}
if (position == PropertyPosition.UseExistingOrCreateAfterLastImport) {
if (projectItem is ProjectImportElement) {
matchedPropertyGroup = null;
}
}
}
return matchedPropertyGroup;
}
ProjectPropertyGroupElement AddNewPropertyGroup(ProjectRootElement targetProject, PropertyPosition position)
{
if (position == PropertyPosition.UseExistingOrCreateAfterLastImport) {
var propertyGroup = targetProject.CreatePropertyGroupElement();
targetProject.AppendChild(propertyGroup);
return propertyGroup;
}
return targetProject.AddPropertyGroup();
}
/// <summary>
/// Removes the property from all configurations and platforms.
/// </summary>

Loading…
Cancel
Save