msbuildmsbuild-buildengine

Edit xml using regular expression in msbuild?


i am working with msbuild script.i want to comment particular line using regular expression in msbuild .pls help me to solve this issue??please give one example other than editing version using regular expression


Solution

  • You can do this using FileUpdate MSBuild Community Tasks:

    FileUpdate
    Replace text in file(s) using a Regular Expression

    <ItemGroup>
       <FilesToBeUpdated Include="/Output/test.xml" />
    </ItemGroup>
    
    <FileUpdate
       Files="@(FilesToBeUpdated)"
       Regex="..."
       ReplacementText="..." />