ScreenCaptureJob not setting in DEVOPS

187 Views Asked by At

The following works on my pc, but when I move to DEVOPs, it errors out.

I have Micrsosoft.Expression.Encoder Installed via nuget. It installs with the nuget installer step on DEVOPS.

The first step of my tests has the following

this.Scj = new ScreenCaptureJob();

and I get the following error:

object reference not set to an instance of an object.

I have the following settings set up in runsettings.

<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>

Is there any other settings in DEVOPS that is needed to run these tests? I have run this on 2017 and 2019 locally. I have the settings as 'Latest', in DEVOPs.

1

There are 1 best solutions below

0
Levi Lu-MSFT On BEST ANSWER

If microsoft.expression.encoder is missing in the standard agents. You can add a powershell task and run below scripts to download and install encoder on those agents.

To download 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")

To install encode_en.exe

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

Powershell tasks shown as below pic: enter image description here