In class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine:
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / BuildPropertyGroup.cs
index 1b2cf7e882a7765015c205eb9e79f2e85662d2b8..56dc782c48ad44b75bd536f53f4fbe0114c05c4e 100644 (file)
@@ -175,25 +175,26 @@ namespace Microsoft.Build.BuildEngine {
                        SetProperty (propertyName, propertyValue, false);
                }
                
-               // FIXME: add a test for SetProperty on property from xml
                public void SetProperty (string propertyName,
                                         string propertyValue,
                                         bool treatPropertyValueAsLiteral)
                {
                        if (read_only)
                                return;
+                       if (FromXml)
+                               throw new InvalidOperationException (
+                                       "This method is only valid for virtual property groups, not <PropertyGroup> elements.");
+
+                       if (treatPropertyValueAsLiteral)
+                               propertyValue = Utilities.Escape (propertyValue);
 
                        if (propertiesByName.ContainsKey (propertyName))
                                propertiesByName.Remove (propertyName);
 
-                       BuildProperty bp;
-                       if (treatPropertyValueAsLiteral)
-                               bp = new BuildProperty (propertyName, Utilities.Escape (propertyValue));
-                       else
-                               bp = new BuildProperty (propertyName, propertyValue);
-                       
+                       BuildProperty bp = new BuildProperty (propertyName, propertyValue);
                        if (Char.IsDigit (propertyName [0]))
-                               throw new ArgumentException (String.Format ("The name \"{0}\" contains an invalid character \"{1}\".", propertyName, propertyName [0]));
+                               throw new ArgumentException (String.Format (
+                                       "The name \"{0}\" contains an invalid character \"{1}\".", propertyName, propertyName [0]));
 
                        AddProperty (bp);