in src/StructuredLogger/Construction/Construction.cs [1123:1187]
private void AddProperties(TreeNode parent, IEnumerable<KeyValuePair<string, string>> properties, IProjectOrEvaluation project = null)
{
if (properties == null)
{
return;
}
if (properties is ICollection collection)
{
parent.EnsureChildrenCapacity(collection.Count);
}
bool tfvFound = false;
bool platformFound = false;
bool configFound = false;
foreach (var kvp in properties)
{
var property = new Property
{
Name = SoftIntern(kvp.Key),
Value = SoftIntern(kvp.Value)
};
parent.Children.Add(property); // don't use AddChild for performance
property.Parent = parent;
if (project != null)
{
if (!tfvFound && string.Equals(kvp.Key, Strings.TargetFramework, StringComparison.OrdinalIgnoreCase))
{
project.TargetFramework = kvp.Value;
tfvFound = true;
}
else if (!tfvFound && string.Equals(kvp.Key, Strings.TargetFrameworks, StringComparison.OrdinalIgnoreCase))
{
// we want TargetFramework to take precedence over TargetFrameworks when both are present
if (string.IsNullOrEmpty(project.TargetFramework) && !string.IsNullOrEmpty(kvp.Value))
{
project.TargetFramework = kvp.Value;
tfvFound = true;
}
}
// If neither of the above are there - look for the old project system
else if (!tfvFound && project.TargetFramework is null && string.Equals(kvp.Key, Strings.TargetFrameworkVersion, StringComparison.OrdinalIgnoreCase))
{
// Note this is untranslated, so e.g. "v4.6.2" instead of "net462" - this is intentional as it
// renders the badge for all projects, but you can still use this difference to tell what is/isn't an SDK project.
project.TargetFramework = kvp.Value;
tfvFound = true;
}
else if (!platformFound && string.Equals(kvp.Key, Strings.Platform, StringComparison.OrdinalIgnoreCase))
{
project.Platform = kvp.Value;
platformFound = true;
}
else if (!configFound && string.Equals(kvp.Key, Strings.Configuration, StringComparison.OrdinalIgnoreCase))
{
project.Configuration = kvp.Value;
configFound = true;
}
}
}
}