/XComponent.MSBuild.Tasks

Custom MSBuild tasks

Primary LanguageC#Apache License 2.0Apache-2.0

XComponent MSBuild Tasks

NuGet NuGet

This project contains custom MSBuild tasks developed by XComponent team.

Invoking a task

The following example shows a project file invoking the ReplaceInFiles task:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
    <UsingTask TaskName="XComponent.MSBuild.Tasks.ReplaceInFiles"   
        AssemblyFile="XComponent.MSBuild.Tasks.dll"/>  
  
    <Target Name="MyTarget">
        <ItemGroup>
            <FileToModify>
                <FullPath>.\TestA.txt</FullPath>
            </FileToModify>
            <FileToModify>
                <FullPath>.\TestB.txt</FullPath>
            </FileToModify>
        </ItemGroup>  
        <ReplaceInFiles 
                Files="@(FileToModify)"
                Regex="[a]"
                ReplacementText="b"/>  
    </Target>  
</Project>  

ReplaceInFiles task replaces a pattern described as a Regex by the string provided in ReplacementText.
So the example replaces 'a' caracters with 'b' caracters in TestA.txt and TestB.txt files.

License

Apache License V2