0

I'm using TFS Release Management. In my deployment, I want to replace tokens in a file, but first, I need a task to rename the file (overwriting the one that is there already).

Seems like it should be super obvious, but I can't seem to get it to work.

Thanks in advance for any help :)

Datum Geek
  • 1,358
  • 18
  • 23

1 Answers1

0

Possibly duplicate with this question: Visual Studio Team Services Release Definition - Task to rename a file?

Try this method:

1) Add the "Inline Powershell" task from the marketplace

2) Enter the following Powershell in the text area

Param  
(  
 [string]$pathToFileToRename  
)  

Rename-Item $pathToFileToRename NewName.txt  

3) Enter any required arguments in the arguments text box (you can use environment variables) e.g.

pathToFileToRename $(System.DefaultWorkingDirectory)/somepath/CurrentName.txt

How to run the task please refer this blog: Using the Inline PowerShell VSTS task

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62