Compilation Exceptions when Executing Remotely

PROBLEM

My test list executes exception free when it is executed from the project location. If I schedule it to be executed remotely there are compilation exceptions in the execution log similar to this one:

Compile failed: c:\Users\someuser\AppData\Local\Temp\8\Projects\2fa80212-43cb-4b99-882c-e69f4d1936d2\TestRemoteElemMissing\RunTest.tstest.cs(53,19) : error CS1061: 'TestRemoteElemMissing.Pages' does not contain a definition for 'Google' and no extension method 'Google' accepting a first argument of type 'TestRemoteElemMissing.Pages' could be found (are you missing a using directive or an assembly reference?)

Such problem could be present when using a scheduling setup or executing remotely a test list. By design when a test list has been scheduled - on the remote machines are uploaded only tests listed for execution. It is possible though that during the recording an element is recorded in one test (Test 1 on the image bellow).

Defined Element

The same element could be reached from another test for example - in a RunTest coded step (on the image below).

Used in Different Test

Executing on the machine where the project is located would cause no compilation problem since the complete project is compiled before the execution. If RunTest is placed in a test list for remote/scheduled execution the given above compilation exception would occur.

SOLUTION 1

An approach to avoid such cross test elements definition problem could be to locate the element using a find expression before to implement actions on it. Not to refer it trough Pages. A sample of this approach is given below:

Different Logic

SOLUTION 2

If the test project is in a TFS source controlled environment when schedule the test list (Step 2) there is an option - "Get latest version of tests automatically from TFS". Once this option is enabled the entire project would be downloaded on the remote machine and compiled there exception free.