Is there anyway to modify each item in an item group? For example, given this item:
<_CustomAreas Include="..\My.Project.*\Areas\**\*.*" Condition="'$(AppBuildFolder)' == ''" />
I want to remove the "..\My.Product.* portion. Basically we have separate project containing MVC areas, and in the Package / Deployment (MSDeploy) we want to copy them into the main project. Here's where the group is used:
<FilesForPackagingFromProject Include="%(_CustomAreas.Identity)">
<DestinationRelativePath>Areas\%(relativedir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
$(relativedir)
is coming through as "..\My.Project.Plugin1\Areas**." and it ends up in the package as ZipFileRoot\My.Project.Plugin1\Areas
(The .. backs out of the hardcoded Areas, and then it just creates the folder for the plugin\areas) where I'd like it to actually all end up in ZipFileRoot\Areas
.
Thanks Andy
The RegexReplace (credentials: guest/guest) task should be able to match \My.Product.*
and replace with an empty string.
Something like this should work: (untested, need to verify escaping)
<RegexReplace Input="%(_CustomAreas)" Expression="\\My\.Product\..*" Replacement="" Count="-1">
<Output ItemName="_CustomAreas" TaskParameter="Output" />
</RegexReplace>
There's a little work getting the MSBuild Community Tasks up and running, but enough good stuff in there for me to find it worth the effort.