dotnet / dotnet/wpf

WPF isn't passing all item metadata to its temporary local type assembly project

Open
#4,211 0 comments 1 reaction 0 assignees View on GitHub
Design Discussion Feature Request
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

WPF only includes two types of metadata in its temp project: Aliases and EmbedInteropTypes.

https://github.com/dotnet/wpf/blob/master/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs#L653

```cs
for (int i = 0; i < pItemList.Length; i++)
{
// Create an element for the given sItemName
XmlElement nodeItem = xmlProjectDoc.CreateElement(sItemName, root.NamespaceURI);

// Create an Attribute "Include"
XmlAttribute attrInclude = xmlProjectDoc.CreateAttribute(INCLUDE_ATTR_NAME);

ITaskItem pItem = pItemList[i];

// Set the value for Include attribute.
attrInclude.Value = pItem.ItemSpec;

// Add the attribute to current item node.
nodeItem.SetAttributeNode(attrInclude);

string embedInteropTypesMetadata = pItem.GetMetadata(EMBEDINTEROPTYPES);
if (!String.IsNullOrEmpty(embedInteropTypesMetadata))
{
embedItem = xmlProjectDoc.CreateElement(EMBEDINTEROPTYPES, root.NamespaceURI);
embedItem.InnerText = embedInteropTypesMetadata;
nodeItem.AppendChild(embedItem);
}

string aliases = pItem.GetMetadata(ALIASES);
if (!String.IsNullOrEmpty(aliases))
{
embedItem = xmlProjectDoc.CreateElement(ALIASES, root.NamespaceURI);
embedItem.InnerText = aliases;
nodeItem.AppendChild(embedItem);
}

// Add current item node into the children list of ItemGroup
nodeItemGroup.AppendChild(nodeItem);
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.