Unit testing Visual Studio 2013无法打开测试窗口

Unit testing Visual Studio 2013无法打开测试窗口,unit-testing,visual-studio-2013,mstest,visual-studio-test-runner,Unit Testing,Visual Studio 2013,Mstest,Visual Studio Test Runner,当我打开Visual Studio 2013并加载我的解决方案时,会收到一条错误消息,告诉我测试窗口无法加载 The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information. 1) Cannot compose part 'Micr

当我打开Visual Studio 2013并加载我的解决方案时,会收到一条错误消息,告诉我测试窗口无法加载

The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) Cannot compose part 'Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection.
Element: Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal -->  Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal

Resulting in: Cannot get export 'Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal (ContractName="Microsoft.VisualStudio.TestWindow.Data.TestsService+ITestsServiceInternal")' from part 'Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal'.
Element: Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal (ContractName="Microsoft.VisualStudio.TestWindow.Data.TestsService+ITestsServiceInternal") -->  Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal

The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) An operation is not legal in the current state. (Exception from HRESULT: 0x80131509)

Resulting in: An exception occurred while trying to create an instance of type 'Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost'.

Resulting in: Cannot activate part 'Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost'.
Element: Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost -->  Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost

Resulting in: Cannot get export 'Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost (ContractName="Microsoft.VisualStudio.TestWindow.Controller.IOpenResult")' from part 'Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost'.
Element: Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost (ContractName="Microsoft.VisualStudio.TestWindow.Controller.IOpenResult") -->  Microsoft.VisualStudio.TestWindow.VsHost.TestWindowHost

Resulting in: Cannot set import 'Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal..ctor (Parameter="openResult", ContractName="Microsoft.VisualStudio.TestWindow.Controller.IOpenResult")' on part 'Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal'.
Element: Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal..ctor (Parameter="openResult", ContractName="Microsoft.VisualStudio.TestWindow.Controller.IOpenResult") -->  Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal

Resulting in: Cannot get export 'Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal (ContractName="Microsoft.VisualStudio.TestWindow.Data.TestsService+ITestsServiceInternal")' from part 'Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal'.
Element: Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal (ContractName="Microsoft.VisualStudio.TestWindow.Data.TestsService+ITestsServiceInternal") -->  Microsoft.VisualStudio.TestWindow.Controller.TestsServiceInternal

Visual Studio根本无法运行测试。关闭或重新打开测试窗口会显示相同的错误。

这似乎是由组件模型缓存中的损坏引起的

关闭Visual Studio的所有实例,然后导航到文件夹并将其删除

%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\ComponentModelCache


现在重新启动Visual Studio,它应该会再次工作。

删除解决方案。v12.suo解决方案。suo也可以帮助解决问题。

只需关闭并重新打开Visual Studio(2015)可能会有所帮助。

我试图找到最佳答案(导航到文件夹并将其删除。%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\ComponentModelCache)但它不起作用,但基于此方法,我找到了适合我的解决方案:

导航到文件夹并将其删除: %LOCALAPPDATA%\Microsoft\WDExpress\11.0\ComponentModelCache


希望我能以这种方式帮助一些人

我在visual studio 2013中没有组件模型缓存。我如何修复此错误?我有相同的错误,尽管我有组件模型缓存,但删除它并不能解决我的问题。我会将此建议保留在工具箱中。事实证明,在我删除组件模型缓存后然后退出并重新启动VS,问题被清除。这对我来说适用于Visual Studio 2015-将12.0替换为14.0