Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Team Services Release Definition - Task to rename a file?

How can I rename a file in a release definition in Visual Studio Team services? Is there a built-in or marketplace task available or otherwise, how can this be achieved?

Answer:

  1. Add the "Inline PowerShell" task from the marketplace
  2. Enter the following PowerShell code 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), for example.

    pathToFileToRename $(System.DefaultWorkingDirectory)/somepath/CurrentName.txt
    
like image 600
Dan Cook Avatar asked Sep 06 '16 20:09

Dan Cook


1 Answers

Use the Run Command Line task or do it in a PowerShell script and invoke the script in your release.

like image 63
Daniel Mann Avatar answered Oct 19 '22 13:10

Daniel Mann