Having to convert a ITaskItem[] to a ITaskItem may happen with MSBuild target batching. For example, this happens with the Microsoft.SourceLink.GitHub.GetSourceLinkUrl task where the SourceRoot parameter is somehow translated from what should be a property with metadata to a list of task items.
Without this translation, the following error would occur:
System.ArgumentException: Object of type 'Microsoft.Build.Framework.ITaskItem[]' cannot be converted to type 'Microsoft.Build.Framework.ITaskItem'.
Having to convert a
ITaskItem[]
to aITaskItem
may happen with MSBuild target batching. For example, this happens with the Microsoft.SourceLink.GitHub.GetSourceLinkUrl task where theSourceRoot
parameter is somehow translated from what should be a property with metadata to a list of task items.Without this translation, the following error would occur: