I would like to use the “MSBuild” task in my target in order to build another project, while passing some items (with their metadata) from the current project to the project to be built.
While it’s possible to pass properties using the Properties attribute or the AdditionalProperties Metadata, I couldn’t find a way to pass Items.
A possible solution could be to write the items to a file and pass the filename as a property, but this would pass only the items, without their metadata.
Any idea?
Thanks.
It is fairly straightforward to write a custom task to dump items and their metadata to a file, to be picked up by another process. Instead of just dumping the items in raw text form though, generate a valid MSBuild project file containing the item group (with item meta data) and have that generated file imported by the project being executed by the MSBuild task. You can even use an MSBuild 4.0 inline task to dump the file.
(response to comment)