public void SetValue(string name, string value, string defaultValue = null, bool preserveExistingCase = false, MSBuildValueType valueType = null) { // If no value type is specified, use the default if (valueType == null) { valueType = preserveExistingCase ? MSBuildValueType.DefaultPreserveCase : MSBuildValueType.Default; } if (value == null && defaultValue == "") { value = ""; } var prop = (MSBuildProperty)GetProperty(name); var isDefault = value == defaultValue; if (isDefault) { // if the value is default, only remove the property if it was not already the default // to avoid unnecessary project file churn if (prop != null && (defaultValue == null || !valueType.Equals(defaultValue, prop.Value))) { RemoveProperty(prop); } return; } if (prop == null) { prop = AddProperty(name); } prop.SetValue(value, valueType: valueType); prop.HasDefaultValue = isDefault; }
void IPropertySet.SetValue(string name, string value, string defaultValue, bool preserveExistingCase, bool mergeToMainGroup, string condition, MSBuildValueType valueType) { SetValue(name, value, defaultValue, preserveExistingCase, valueType); }