MSBUILD项目:从另一个项目获取项目列表,并打印出foreach
例如,有两个项目:
Main.Proj
<MyCustomItemHa Include="path1"/>
<MyCustomItemHa Include="path2"/>
<MyCustomItemHa Include="path3"/>
还有一个单独的项目
Secondary.Proj
<Target Name="Printtt">
** How can I execute <Message here for each of paths imported above? **
** To Get output equivalent to: **
** <Message Text="path1" /> **
** <Message Text="path2" /> **
** <Message Text="path3" /> **
** for each MyCustomItemHa from Main.Proj **
</Target>
For example, there are two projects:
Main.Proj
<MyCustomItemHa Include="path1"/>
<MyCustomItemHa Include="path2"/>
<MyCustomItemHa Include="path3"/>
And there is a separate project
Secondary.Proj
<Target Name="Printtt">
** How can I execute <Message here for each of paths imported above? **
** To Get output equivalent to: **
** <Message Text="path1" /> **
** <Message Text="path2" /> **
** <Message Text="path3" /> **
** for each MyCustomItemHa from Main.Proj **
</Target>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MSBUILD是一种声明性的语言,没有循环。 MSBuild中没有foreach循环。
您可以使用任务批处理 - 请参阅 msbuild batching << /a>。
例如,代码
将显示
两个独立的项目无法“看到”对方,并且无法从彼此中获得
itemgroup
。但是您可以创建一个定义itemGroup
的常见文件,每个项目都可以import
公共文件。MSBuild is a declarative language and has no loops. There is no foreach loop in MSBuild.
You can use task batching - see MSBuild batching.
As an example, the code
will display
Two separate projects can't 'see' each other and can't get an
ItemGroup
from each other. But you can create a common file that defines theItemGroup
and each project canImport
the common file.