Is it possible to dependency-check multiple inputs for each output when using MSBuild batching?
I thought I’d found a solution to this by constructing my inputs list in the metadata of the output file, as follows:
<ItemGroup>
<Foo Include="output1">
<Inputs>input1a;input1b</Inputs>
</Foo>
<Foo Include="output2">
<Inputs>input2a;input2b</Inputs>
</Foo>
</ItemGroup>
<Target Name="_CompileFoo" Outputs="@(Foo)" Inputs="%(Foo.Inputs)">
<FooCompiler Src="%(Foo.Inputs)" Out="@(Foo)" />
</Target>
However, MSBuild complains that the file “input1a;input1b” does not exist. It seems that the string->items conversion takes place before the expression evaluation.
Is there any solution to this other than writing my own dependency checking?
Checking multiple dependencies works if the item group is set up the other way round with the compilation result as metadata.
And instead of manually converting the
Fooitem group, you can transform this in a prerequisite target building a new item group_Fooas follows.