Condition = value;
break;
default:
- throw new InvalidProjectFileException (string.Format (
+ throw new InvalidProjectFileException (Location, null, string.Format (
"Attribute \"{0}\" is not known on node \"{1}\" [type {2}].", name, XmlName,
GetType ()));
}
writer.WriteAttributeString (attributeName, attributeValue);
}
-#if NET_4_5
public ElementLocation Location { get; private set; }
public ElementLocation LabelLocation { get; private set; }
public ElementLocation ConditionLocation { get; private set; }
-#endif
-
+ string GetFilePath (string baseURI)
+ {
+ return string.IsNullOrEmpty (baseURI) ? string.Empty : new Uri (baseURI).LocalPath;
+ }
+
internal void FillLocation (XmlReader reader)
{
-#if NET_4_5
var l = reader as IXmlLineInfo;
+ var path = GetFilePath (reader.BaseURI);
if (l != null && l.HasLineInfo ())
- Location = new ProjectElementLocation (reader.BaseURI, l);
+ Location = new ProjectElementLocation (path, l);
if (reader.MoveToAttribute ("Condition") && l.HasLineInfo ())
- ConditionLocation = new ProjectElementLocation (reader.BaseURI, l);
+ ConditionLocation = new ProjectElementLocation (path, l);
if (reader.MoveToAttribute ("Label") && l.HasLineInfo ())
- LabelLocation = new ProjectElementLocation (reader.BaseURI, l);
+ LabelLocation = new ProjectElementLocation (path, l);
reader.MoveToElement ();
-#endif
}
class ProjectElementLocation : ElementLocation