1
votes

Until last year we used a an MsBuild file for our build definitions. Since this year we want to use the new vNext buildsystem in the TFS 2015.

And this is my question:

In the xaml file we have a line like

<UsingTask TaskName="ReplaceTextInFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">

to use it later in the xaml like

<ReplaceTextInFile
            InputFilename="$(someFolder)$(someOtherFolder)\someFile.config"
            OutputFilename="$(someFolder)$(someOtherFolder)\someFile.config"
            MatchExpression="$(somePattern)"
            ReplacementText="$(someText)"
        />

How do I implement this to the new vNext???

1
This is not a XAML build file, this is an MsBuild build file.jessehouwing

1 Answers

3
votes

Because this is an MsBuild snippet you've posted, you could simply use the Run MsBuild task and execute the old project file.

But if you are set on porting, then you have a few options:

  • Use one of the Replacement extensions from the VSTS marketplace, there are a few, I personally have good experiences with this one or this one.
  • Create a powershell/shell/batch script that does what you want and use the (inline) (power) shell task to run the script as part of your build. Powershell has very powerful regex options using -match and -replace.