根据我的测试,XML variable substitution
可以XML transformation
同时工作。
这是原始的 web.config 文件:

检查日志,转换发生在_temp
文件夹而不是$(System.DefaultWorkingDirectory)
(例如我使用部署组运行任务,所以 $(System.DefaultWorkingDirectory) 路径是C:\azagent\A18\_work\r4\a
)。

在临时文件夹中,我注意到文件已成功转换。

如果你部署的对象是一个文件夹,那么这个转换只能在临时文件夹中找到。部署完成后,该文件夹的内容会在部署后自动删除。
如果你部署的对象是一个zip文件,除了temp文件夹,$(System.DefaultWorkingDirectory)
路径中会自动生成一个zip,这个zip中的web.config文件也转化成功。


更新:
以下是一些细节:
文件:(web.config 和 web.qa.config)

网络配置:
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PCWSUser" value="TheUserName" />
</appSettings>
Web.qa.config:
<appSettings>
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="webpages:Enabled" value="true" />
<add key="PCWSUser" value="TheUserNameQA" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
发布管道变量:

任务设置:

摘要:webpages:Version
由变量替换改变。其他的通过xml转换来改变。