Microsoft Expression Encoder and Selenium + TeamCity
<p>I'm trying to record my Selenium tests execution with Microsoft Expression Encoder. I've found many answers about the problem I'm currently facing but none of them really solved it. So, I have a method that starts the video recording process. It goes as simple as</p>

<pre><code>        scj = new ScreenCaptureJob();
        scj.OutputScreenCaptureFileName = logPath + "\\" + fileName + ".wmv";
        scj.ScreenCaptureVideoProfile.FrameRate = 25;
        scj.CaptureMouseCursor = true;
        scj.Start();
</code></pre>

<p>When I run it from Visual Studio 2015 it works perfectly fine. But when I run it from TeamCity in one of our build agents, I get the following message:</p>

<pre><code>OneTimeSetUp: System.BadImageFormatException: Could not load file or assembly 
'Microsoft.Expression.Encoder, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
or one of its dependencies. An attempt was made to load a program with an incorrect format
</code></pre>

<p>Now, for what I've read over some forums, this is related to my architecture selection. In TeamCity, the build step that compiles the code has the "Any CPU" platform selected whereas in Visual Studio, "Mixed Platforms" is selected. </p>

<p>I already tried setting everything to x86 architecture in TeamCity, force NUnit 3 to run as a 32-bits process and also changing my project's target archicteture. None of those solutions has worked. Does anyone have any idea of what else I could do?</p>