简体   繁体   中英

TFS2015 Visual Studio Test: Could not load file or assembly

I have an "old" XAML Build Definition, made in Visual Studio; which builds a solution and following runs unit tests. Now I've tried to make the same in the new TFS 2015 web surface. I've created a build task, following Visual Studio Test.

But now the Test-Task exit with code 1 and gives me a lot of "System.IO.FileNotFoundException: Could not load file or assembly" errors. And also "Warning: MSTestAdapter failed to discover tests in class ..."

All the DLLs are where they have to be, the new definition has the same directory structure like the old one, but the test-task says there are missing assemblys.

Any ideas?

Update: No, I still have the same error messages:

Warning: Unable to load types from the test source 'J:\xyz-Tests.dll'. Some or all of the tests in this source may not be discovered. If you are running unit tests for Windows Store apps and referencing custom WinMD type then please visit http://go.microsoft.com/fwlink/?LinkId=238340 for more info. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'xyz_Commons, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'xyz_Processing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'xyzCommons, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

This should exactly be the issue mentioned in below article, please try following the workaround to fix it:

Running Coded UI Tests built using Visual Studio 2013 with Team Foundation Server 2015

Test execution is failing in this scenario because test execution engine is not able to resolve the old version binaries while executing tests in a 14.0 environment (TFS 2015).

So, you need to update the projects to reference the new versions of the assemblies (VS 2015 in this scenario) using the assembly bindings in the test projects config file.

As a workaround to this issue, add an 'app.config' file to your solution (See how to add app.config https://msdn.microsoft.com/en-in/library/ms184658.aspx ) and update the contents of the file with the shared on OneDrive . The updated configuration files contain assembly redirects from version 12.0 to 14.0, which will make sure that the test agent machine is able to resolve the framework assemblies. Check-in the updated configuration file into the source control repository and run the BDT scenario once again. The tests should run fine this time. If the test execution again throws an error complaining version mismatch for some other assembly, add the assembly to the app.config file and retry.

You can also reference this article : http://www.dotnetcatch.com/2015/10/01/tfs-2010-to-2015-upgrade-codedui-feature-test-builds/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM