Coded UIVisual Studio / TFS

Test Agent & Controller Setup for Visual Studio 2015 | Workaround

For testing the scenarios using Visual Studio 2015 and Visual Studio Team Services or Team Foundation Server (TFS) 2015, you won’t need a test controller because Agents for Microsoft Visual Studio 2015 handle orchestration by communicating with Team Services or TFS 2015. If one would install VS 2015 Agent when tried to invoke it through the controller. It gives error “Run Test agent Configuration tool to configure agent”

Microsoft announced that Agents no longer needed a Test Controller, as the agent orchestration is managed by the server (TFS or VSO), if you try to configure VS 2015 agent with old controllers you may get the following error:

And if you use the old agents with vs 2015 complied code then you would see the following:

Could not load file or assembly Microsoft.VisualStudio.QualityTools.CodedUITestFramework

However, in case, you haven’t moved to VNEXT builds and still using XAML, you would have to stick to the same agent/controller architecture. However, this will need some workaround

Here, is the compatibility matrix:

Microsoft Test Manager, with Lab Center
2015: upgrade from 2013 2013 2013 2013
2015: new install 2013 2013 2013
2015: upgrade from 2015 or new install 2015 2013 2013
2013 2015 2013 2013

Following combination should be working fine

  • TFS 2015
  • Test Controller 2013 (update 5)
  • Test Agent 2013 (update 5) 

Let’s see how to setup:

  1. Settings the Controller

  2. Settings the Agent
    • Validate the .Net version and install if required
    • Install Vs 2013 Update 5 Agent (Prefer to install on d Drive)
    • Install Visual studio 2015 on the agent, this is to make the version 14 dlls available
    • Next step add Vs 2015 libraries to GAC, which  is required by the test agent.So the next step is execute powershell script, which import private assemblies to GAC ( change the location as per your installation):
        • Open the powershell in admin mode and run the following
          • Set-ExecutionPolicy -ExecutionPolicy Unrestricted
          • $Alldlls=Get-ChildItem “d:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies” -Filter *.dll -Recurse$pathToGACUtil= “C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil.exe”foreach ($dll in $Alldlls){
            “Path to dll: “+$dll.FullName

            & $pathToGACUtil /i $dll.FullName


          • $Alldlls=Get-ChildItem “D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies” -Filter *.dll -Recurse$pathToGACUtil= “C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil.exe”foreach ($dll in $Alldlls)
            “Path to dll: “+$dll.FullName& $pathToGACUtil /i $dll.FullName


    • Make sure that the user you are using is part of admin group on the machine
    • Now create the environment using MTM and add the agent machine
    • Stop the agent service and add any custom test data collector that your project may have to \Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\DataCollectors
    • Restart the machine
  3. Try executing the test, in case you get an error like below, you may have to perform an additional step:

 Unit Test Adapter threw exception: The following package failed to load:                        C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.TestTools.UITest.Framework\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITesting.dll.Could not load file or assembly ‘file:///C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.TestTools.UITest.Framework\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITesting.dll’ or one of its dependencies. The system cannot find the file specified..

All you have to do is locate


and copy this file to


Following Script may help you in case you don’t want to do it manually: 

$UITestingdlls=Get-ChildItem “C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TestTools.UITesting” -Filter *UITesting.dll -Recurse
foreach ($UITestingdll in $UITestingdlls)
if($UITestingdll.FullName -match “14.0”)
Write-Host $FullPathToUITestingdll
$UITestingFrameworkdlls=Get-ChildItem “C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TestTools.UITest.Framework” -Filter *Framework.dll -Recurse
foreach ($UITestingFrameworkdll in $UITestingFrameworkdlls)
if($UITestingFrameworkdll.FullName -match “14.0”)
Write-Host $PathToUITestingFrameworkdll
Copy-Item $FullPathToUITestingdll $PathToUITestingFrameworkdll

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.