我正在使用Powershell构建步骤,并希望生成一个文件并将其包含在工件中。这是我尝试过的,但它并没有出现:
param(
[parameter(Mandatory=$true)] [string]$controller
)
Write-Output "Controller: $controller"
$testsettingsXML = @"
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Remote" id="36b029f0-1e34-4c17-b7b1-3e6a0284a08e" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<RemoteController name="$controller" />
<Execution location="Remote">
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
</TestTypeSpecific>
<AgentRule name="AllAgentsDefaultRole">
</AgentRule>
</Execution>
<Properties />
</TestSettings>
"@
#write the testsettings file out to disk.
$testsettingsXML | Out-File -FilePath "./remotehack.testsettings" -Encoding utf8
我在metarunner中做了类似的事情并且工作得很好。为什么不在这里?
答案 0 :(得分:0)
问题是三方面的。
Powershell的最后一行应该是这样的:
$ testsettingsXML | Out-File -FilePath“remotehack.testsettings”-Encoding utf8
我没有将remotehack.testsettings / remotehack.testsettings作为工件依赖项包含
一些新手的错误。