簡體   English   中英

TFS2015 Visual Studio測試:無法加載文件或程序集

[英]TFS2015 Visual Studio Test: Could not load file or assembly

我有一個在Visual Studio中創建的“舊的” XAML構建定義; 這將構建一個解決方案並隨后運行單元測試。 現在,我嘗試在新的TFS 2015 Web界面中進行相同的設置。 我已經在Visual Studio測試之后創建了一個構建任務。

但是現在Test-Task退出,代碼為1,並給了我很多“ System.IO.FileNotFoundException:無法加載文件或程序集”錯誤。 還有“警告:MSTestAdapter無法在類中發現測試……”

所有DLL都必須存在,新定義具有與舊DLL相同的目錄結構,但測試任務表明缺少程序集。

有任何想法嗎?

更新:不,我仍然有相同的錯誤消息:

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.

這恰好是以下文章中提到的問題,請嘗試按照以下解決方法進行修復:

運行使用Visual Studio 2013和Team Foundation Server 2015構建的已編碼UI測試

在這種情況下,測試執行失敗,因為在14.0環境中執行測試時,測試執行引擎無法解析舊版本的二進制文件(TFS 2015)。

因此,您需要使用測試項目配置文件中的程序集綁定來更新項目以引用程序集的新版本(在這種情況下為VS 2015)。

作為解決此問題的方法 ,請將“ app.config”文件添加到您的解決方案中(請參閱如何添加app.config https://msdn.microsoft.com/en-in/library/ms184658.aspx )並更新內容與OneDrive上的共享文件共享。 更新的配置文件包含從版本12.0到14.0的程序集重定向,這將確保測試代理計算機能夠解析框架程序集。 將更新的配置文件檢入到源代碼控制存儲庫中,然后再次運行BDT方案。 這次測試應該運行良好。 如果測試執行再次引發錯誤,提示某些其他程序集的版本不匹配,請將該程序集添加到app.config文件中,然后重試。

您也可以參考此文章: http : //www.dotnetcatch.com/2015/10/01/tfs-2010-to-2015-upgrade-codedui-feature-test-builds/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM