MSBUild: Copy files with a name based on the original (following a pattern)

前端 未结 4 1980
温柔的废话
温柔的废话 2021-02-12 23:39

I have a set of files inside a folder. They all have a name which matches the pattern DR__.*. I want to copy them to another folder, but removing the DR__ prefix. How can I do t

4条回答
  •  春和景丽
    2021-02-13 00:40

    Can you use MSBuild 4.0? If so, then refer to this answer (and MSDN help). Otherwise the RegexReplace task in MSBuildCommunityTasks should also work, at the cost of having to support an external tool (so go MSBuild 4.0 if possible).

    Another (untested) option is the TextString task in MSBuildExtensionPack.

    Failing those, roll your own task?

提交回复
热议问题