public string GetMetadata(string attributeName)
{
if (attributeName == null)
throw new ArgumentNullException("attributeName");
if (string.IsNullOrEmpty(attributeName))
throw new ArgumentException("attributeName cannot be null or empty");
if (HasItemBeenDeleted)
throw new InvalidOperationException("The item has been deleted.");
if(this.IsVirtual)
{
// For virtual items, use our virtual property collection
if(!virtualProperties.ContainsKey(attributeName))
return String.Empty;
return ProjectCollection.Unescape(virtualProperties[attributeName]);
}
// cannot ask MSBuild for Include, so intercept it and return the corresponding property
if(String.Equals(attributeName, ProjectFileConstants.Include, StringComparison.OrdinalIgnoreCase))
return Item.EvaluatedInclude;
// Build Action is the type, not a property, so intercept this one as well
if(String.Equals(attributeName, ProjectFileConstants.BuildAction, StringComparison.OrdinalIgnoreCase))
return Item.ItemType;
return Item.GetMetadataValue(attributeName);
}