C
C#10mo ago
Chik3r

✅ Output TaskParameter is unrecognized

I'm trying to use CreateItem to add metadata to an item using batching, but it says that
error MSB4066: The attribute "TaskParameter" in element <Output> is unrecognized.
error MSB4066: The attribute "TaskParameter" in element <Output> is unrecognized.
Code that throws:
<CreateItem Include="@(_ResolvedProjectReferencePaths)" AdditionalMetadata="ProjectPath=%(OriginalItemSpec)" Condition="'@(_ResolvedProjectReferencePaths)'!=''">
<Output TaskParameter="Include" ItemName="TmpResolvedProjects" />
</CreateItem>
<CreateItem Include="@(_ResolvedProjectReferencePaths)" AdditionalMetadata="ProjectPath=%(OriginalItemSpec)" Condition="'@(_ResolvedProjectReferencePaths)'!=''">
<Output TaskParameter="Include" ItemName="TmpResolvedProjects" />
</CreateItem>
5 Replies
reflectronic
reflectronic10mo ago
you should not use CreateItem. it is deprecated you should use ItemDefinitionGroup instead
<ItemDefinitionGroup>
<_ResolvedProjectReferencePaths>
<ProjectPath>%(OriginalItemSpec)</ProjectPath>
</_ResolvedProjectReferencePaths>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<_ResolvedProjectReferencePaths>
<ProjectPath>%(OriginalItemSpec)</ProjectPath>
</_ResolvedProjectReferencePaths>
</ItemDefinitionGroup>
as an aside, this code seems extremely sus
Chik3r
Chik3r10mo ago
it's probably not the best or correct way to do what I want I have a list of items with a ProjectPath metadata (that then gets converted to a ProjectReference), and I want to filter _ResolvedProjectReferencePaths to only those that exist in my list (so that I can then get the referenced projects' compiled dll file) I found this (https://stackoverflow.com/questions/42403046/msbuild-itemgroup-intersection) and this (https://learn.microsoft.com/en-us/archive/blogs/msbuild/batching-brainteaser-explained) to get the intersecting items, but I have the issue with CreateItem
Chik3r
Chik3r10mo ago
anyways this didn't work
Accord
Accord10mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Chik3r
Chik3r10mo ago
Bump I decided to just pass the @(_ResolvedProjectReferencePaths) to a custom task and then do the filtering I need there