msbuild-如何将字符串预先添加到ItemGroup中的每个项目 [英] msbuild - how to pre-pend string to each item in ItemGroup

查看:145
本文介绍了msbuild-如何将字符串预先添加到ItemGroup中的每个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目组,我需要在所有项目前添加相同的字符串(以获得正确的路径).

I have an item group and I need to pre-pend the same string to all of them (to get the correct paths).

我该怎么做?

推荐答案

Yo可以使用中间项来执行此修改.让我们将需要更改的预先存在的项目称为MySpecialContent:

Yo can use intermediate items to perform this modification. Let's call the pre-exiting items that need to be changed MySpecialContent:

<ItemGroup>
  <_TmpMySpecialContent Include="@(MySpecialContent)" />
  <MySpecialContent Remove="@(_TmpMySpecialContent)" />
  <MySpecialContent Inclue="@(_TmpMySpecialContent->'my\prefix\%(Identity)')" />
</ItemGroup>

这篇关于msbuild-如何将字符串预先添加到ItemGroup中的每个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆