ScreenCaptureJob未在DEVOPS中设置

时间:2019-08-16 13:51:35

标签: visual-studio selenium azure-devops mstest expression-encoder

以下内容在我的PC上有效,但是当我移至DEVOP时,它会出错。

我有通过nuget安装的Micrsosoft.Expression.Encoder。它在DEVOPS上以nuget installer步骤安装。

我的测试的第一步如下

this.Scj = new ScreenCaptureJob();

,我收到以下错误消息:

object reference not set to an instance of an object.

我在运行设置中设置了以下设置。

<DataCollectionRunSettings>
<DataCollectors>
      <DataCollector uri="datacollector://microsoft/VideoRecorder/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder.VideoRecorderDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Screen and Voice Recorder">
    <!--Video data collector was introduced in Visual Studio 2017 version 15.5 -->
  </DataCollector>
</DataCollectors>

运行这些测试是否需要在DEVOPS中进行其他设置?我已经在2017年和2019年本地运行了此程序。我在DEVOP中将设置设置为“最新”。

1 个答案:

答案 0 :(得分:0)

如果标准代理中缺少microsoft.expression.encoder。您可以添加powershell任务并运行以下脚本,以在这些代理上下载并安装编码器。

要下载encoder.exe

$client = new-object System.Net.WebClient
$link = "https://download.microsoft.com/download/E/3/4/E3423C3F-D17F-43E3-BB06-BC51245F573A/Encoder_en.exe"
$client.DownloadFile($link, "$(Agent.BuildDirectory)/Encoder_en.exe")

要安装encode_en.exe

Start-Process "$(Agent.BuildDirectory)/Encoder_en.exe"  -ArgumentList '/S','/v','/qn' -passthru

Powershell任务如下图所示: Demo