Today we are speaking about supporting old system: test agent 2013.
If you have XAML build definition, which build in TFS 2015 test controller and test agent.
But if QC department use Microsoft Test Manager (MTM), you can't use Test Agent 2015.
You should use test agent 2013 with last updates.
But when you had finished configure Lab build definition, and start execute it, you see next error:
Unit Test Adapter threw exception: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..
What? Of course you build tests with MSBuild 14, in you project exist references to library v 14.0.
How it fix?
Try to install Visual Studio
The first idea, which I tried- install Visual Studio 2015. But after this, you also see same error. It's doesn't depend which version of studio you was installing.
But...
For fix this issue, you should install VS 2015 Enterprise.
Try add assembly...
Next step put to GAC libraries, which required test agent. You can't copy version 14.0 to folder where was installed test agent, because test agent can't start without V 12.0.
So the next step is execute powershell script, which import private assemblies to GAC (to save your time):
$dlls=Get-ChildItem "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies" -Filter *.dll -Recurse
$gacutilPath= "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil.exe"
foreach ($dllInside in $dlls)
{
"Path to dll: "+$dllInside.FullName
& $gacutilPath /i $dllInside.FullName
}
And next script, which import public assemblies:
$dlls=Get-ChildItem "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies" -Filter *.dll -Recurse
$gacutilPath= "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil.exe"
foreach ($dllInside in $dlls)
{
"Path to dll: "+$dllInside.FullName
& $gacutilPath /i $dllInside.FullName
}
After this copy this folders:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies
To GAC, but in specific folder:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TestTools.UITest.Framework
After this try to execute tests from MTM or your lab build definition.
If you have a question, ask in the comments.
If you still have this problem, please read part 2
Good luck!
Hi Maxim,
ReplyDelete1. What version of the test runner, i.e MSTest, are you using to run your tests? I am asking as we do not use MTM to trigger the runs.
2. We encountered the error for a different assembly, Microsoft.VisualStudio.QualityTools.CodedUITestFramework. I followed the steps described but changed them to traget this particular dll but it did not fix the problem. Do you have an ideea if there's something more we could try.
Thanks,
Otilia
Hi Otilia.
ReplyDelete1. We use MSTest version 12.0.40629.0.
2. About assembly. Did you start powershell script run as administrator? Was they show successful adding library to GAC? Which version of tfs build agent do you have? Who trigger runs ? Is it in execute in build definition? Can you write full error message?
Hi Maxim, thanks for the reply.
Delete- Yes, I ran the powershell script did run with administrative rights and it completed successfully;
- The agents are Visual Studio 2013 Update 5, as well as the
controller;
- We trigger them from Team City but the step is configured to be the same as running from the command line
- Error message is:
Unit Test Adapter threw exception:
Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..
Thanks!
Otilia/Future Visitors,
DeleteTo fix this problem you'll have to
1. Install VS 2015 Test Agent
2. Modify the powershell script to ALSO point to VS 2015 (change the 12.0 to 14.0). Execute it again.
3. Copy the VS 2015 public and private assembly folders into the Gac
Hope this helps.
So, please check again path C:\Windows\Microsoft.NET\assembly\GAC_MSIL.
ReplyDeleteTry find this library version of 14.0
If you have this version and still have error, Find anywhere this library version 14.0,
and put to this path C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies
(Make sure, that you have back-up of this folder).
If you haven't this version, try execute powershell script which install to gac from administrator.