Raise error when project item has empty Include attribute or lacks it.
[mono.git] / mcs / class / Microsoft.Build / Microsoft.Build.Construction / ProjectOtherwiseElement.cs
index 781ffbffa958378bdb9f366bd3405c61f0a29fa8..b8a2d6bec03d15421b3a81f8d7c931baf18cfe95 100644 (file)
@@ -29,6 +29,7 @@
 using System.Collections.Generic;
 using System;
 using System.Linq;
+using System.Xml;
 using Microsoft.Build.Exceptions;
 using Microsoft.Build.Internal;
 
@@ -45,7 +46,12 @@ namespace Microsoft.Build.Construction
                         get { return new CollectionFromEnumerable<ProjectChooseElement> (
                                 new FilteredEnumerable<ProjectChooseElement> (Children)); }
                 }
-                public override string Condition { get; set; }
+                public override string Condition {
+                        get { return null; }
+                        set {
+                                throw new InvalidOperationException ("Can not set Condition.");
+                        }
+                }
                 public ICollection<ProjectItemGroupElement> ItemGroups {
                         get { return new CollectionFromEnumerable<ProjectItemGroupElement> (
                                 new FilteredEnumerable<ProjectItemGroupElement> (Children)); }
@@ -57,9 +63,9 @@ namespace Microsoft.Build.Construction
                 internal override string XmlName {
                         get { return "Otherwise"; }
                 }
-                internal override ProjectElement LoadChildElement (string name)
+                internal override ProjectElement LoadChildElement (XmlReader reader)
                 {
-                        switch (name) {
+                        switch (reader.LocalName) {
                         case "PropertyGroup":
                                 var property = ContainingProject.CreatePropertyGroupElement ();
                                 AppendChild (property);
@@ -74,7 +80,7 @@ namespace Microsoft.Build.Construction
                                 return when;
                         default:
                                 throw new InvalidProjectFileException (string.Format (
-                                        "Child \"{0}\" is not a known node type.", name));
+                                        "Child \"{0}\" is not a known node type.", reader.LocalName));
                         }
                 }
         }