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

假如想象 提交于 2019-12-19 13:12:10

问题


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
    

回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!