Visual Studio Team Services版本定义-重命名文件的任务? [英] Visual Studio Team Services Release Definition - Task to rename a file?

查看:81
本文介绍了Visual Studio Team Services版本定义-重命名文件的任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Visual Studio Team Services中的发布定义中重命名文件?是否有内置任务或市场任务可用,否则如何实现?

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?

答案:

  1. 从市场添加内联PowerShell"任务
  2. 在文本区域中输入以下PowerShell代码

  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

  • 例如,在参数文本框中输入任何必需的参数(您可以使用环境变量).

  • Enter any required arguments in the arguments text box (you can use environment variables), for example.

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

  • 推荐答案

    使用运行命令行"任务或在PowerShell脚本中执行该任务,然后在您的发行版中调用该脚本.

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

    这篇关于Visual Studio Team Services版本定义-重命名文件的任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆