构建变量在TFS中的版本中不起作用

时间:2018-04-19 14:59:17

标签: tfs azure-devops release release-management

我尝试使用TFS中的发布,我添加了一个任务a"命令行"

执行类似" python"在工具中,我添加了一个任务a"命令行",  我的文件位于C:\ agent1_work \ 23 \ s \ virtualenvtfs2 \ Scripts \ python

一切正常。但是,当我试图替换像

这样的绝对路径时
"%BUILD_SOURCESDIRECTORY%\$(virtualenvtfs)\Scripts\python" 

"${Build.SourcesDirectory}\$(virtualenvtfs)\Scripts\python"

甚至改为

"${System.DefaultWorkingDirectory}\$(virtualenvtfs)\Scripts\python"

它反复失败,因为它无法找到指定的路径。

2 个答案:

答案 0 :(得分:0)

As I can see in your question, you are trying to read variables from a build source directory in a release pipeline and that you have to do differently then you are trying.

In a release pipeline you have to add your builds as artifacts.

enter image description here

Then, your build will be in a directory that is ${System.DefaultWorkingDirectory}\build artifact name\your files

If are not publishing your artifacts in the build step, you can do it by adding the "Publish build artifacts" build task in the build definition.

答案 1 :(得分:0)

构建变量在发行版中不可用,因此您无法使用它。关于版本变量,请参阅以下文章:Variables in Release Management

正如Rodrigo所说,您可以通过Publish Build Artifacts任务发布必要的文件,然后将构建关联到发布,之后,已发布的文件(构建工件)将下载到 System.DefaultWorkingDirectory (例如C:\ agent_work \ r1 \ a)

相关问题