问题
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:
- Add the "Inline PowerShell" task from the marketplace
Enter the following PowerShell code in the text area
Param ( [string]$pathToFileToRename ) Rename-Item $pathToFileToRename NewName.txt
Enter any required arguments in the arguments text box (you can use environment variables), for example.
pathToFileToRename $(System.DefaultWorkingDirectory)/somepath/CurrentName.txt
回答1:
Use the Run Command Line task or do it in a PowerShell script and invoke the script in your release.
来源:https://stackoverflow.com/questions/39357662/visual-studio-team-services-release-definition-task-to-rename-a-file