在 Microsoft Visual Studio 2017 测试版中打开“测试用例”工作项类型的“步骤”和“关联自动化”选项卡时引发了以下 FileNotFoundException:
System.IO.FileNotFoundException: 无法加载文件或程序集“Microsoft.VisualStudio.QualityTools.Common,Version=15.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。系统找不到指定的文件。文件名:'Microsoft.VisualStudio.QualityTools.Common,Version=15.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a',位于 Microsoft.TeamFoundation.TestManagement.Controls.AssociatedAutomationControl.get_TestManagementService(),位于 Microsoft.TeamFoundation.TestManagement.Controls.AssociatedAutomationControl.get_TestCase(),位于 Microsoft.TeamFoundation.TestManagement.Controls.AssociatedAutomationControl.RelayoutControls(),位于 Microsoft.TeamFoundation.TestManagement.Controls.AssociatedAutomationControl.InvalidateDatasource(),位于 Microsoft.TeamFoundation.WorkItemTracking.WpfControls.LegacyWorkItemControl.InvalidateDatasource(),位于 Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WorkItemControl.ControlFactory_ControlCreated(Object sender, ControlCreatedEventArgs e),位于Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfControlFactory.OnControlCreated(ControlCreatedEventArgs args) 在 Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfControlFactory.CreateControl(String fieldName, String preferredControlType, String fallbackControlType, StringDictionary properties) 在 Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfFormRenderer.CreateControl(FormElement element) 在 Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfFormRenderer.RenderCollection(Grid panel, FormElementCollection collection, Int32& currentCol)
用户有权在 Web 界面上查看内容。此行为无法在其他版本的 Visual Studio 2017(Premium、Enterprise 等)中重现。我尝试通过将缺失的 dll(Microsoft.VisualStudio.QualityTools.Common.dll)从不同机器的 Visual Studio 2017 Enterprise 安装复制到测试版安装的以下文件夹来解决此问题,但没有帮助:
- Common7\IDE\CommonExtensions\Microsoft\TestWindow
- Common7\IDE\Extensions\TestPlatform\TestHost
- Common7\IDE\PublicAssemblies
- Common7\IDE\ReferenceAssemblies\v2.0
请告诉我,这个问题该如何解决。
答案1
最后我终于解决了这个问题。
将 Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion 下的注册表值“EnableLog”DWORD 设置为 1,可以在融合日志中提供有关问题的更多详细信息,特别是程序集的路径(C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer):
=== 预绑定状态信息 === LOG:DisplayName = Microsoft.VisualStudio.QualityTools.Common,Version=15.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a(完全指定)LOG:Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/TeamExplorer/Common7/IDE/ LOG:Initial PrivatePath = NULL 调用程序集:Microsoft.TeamFoundation.TestManagement.Controls,Version=15.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a。
ActivityLog.xml 中记录了针对 Microsoft.VisualStudio.QualityTools.Resource.DLL 的几次下载尝试,我选择了第一次(与 Fusion Log 中的相同):
C:\Program 文件(x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
并将以下三个缺失的 dll 复制到此处:
Microsoft.VisualStudio.QualityTools.Common.dll Microsoft.VisualStudio.QualityTools.Resource.dll Microsoft.VisualStudio.QualityTools.Vsip.dll
Visual Studio 重新启动后,测试用例工作项的所有内容都已正确加载。