MSBuild ITaskItem RecursiveDir metadata disappears

一个人想着一个人 提交于 2019-11-30 15:33:37

Yes, this is normal. There is nothing you can do about it. I have gone through the MSBuild source code thorougly and apparently, the items going into a custom task and the items coming back out are completely different things. MSBuild creates its own very special items at first and later they become significantly "dumber".

The solution I found for such cases:

  1. Create an all-inclusive ItemGroup.
  2. Create a custom task that generates an ItemGroup with the files you want to remove.
  3. Use <ItemGroup Remove="@(ListFromCustomTask)" />
user1199959

I just ran into this same exact issue. I was able to successfully work around this "limitation" (MSBuild bug in my opinion) by explicitly setting the "RecursiveDir" metadata value to its current value.

After doing this, my output ITaskItem[] retained the value.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!