【问题标题】:Visual Studio 2013 is unable to open the Test WindowVisual Studio 2013 无法打开测试窗口
【发布时间】:2013-12-16 14:11:03
【问题描述】:

当我打开 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 根本无法运行测试。关闭重新打开测试窗口显示相同的错误。

【问题讨论】:

    标签: unit-testing visual-studio-2013 mstest visual-studio-test-runner


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        【解决方案3】:

        删除 solution.v12.suosolution.suo 也有助于解决问题。

        【讨论】:

          【解决方案4】:

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

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

          %LOCALAPPDATA%\Microsoft\VisualStudio\12.0\ComponentModelCache

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

          【讨论】:

          • Visual Studio 2013 中没有组件模型缓存。如何解决此错误?
          • 我有同样的错误,虽然我确实有组件模型缓存,但删除它并没有解决我的问题。
          • 我会将这个建议保留在我的工具箱中。事实证明,在我删除了组件模型缓存然后退出并重新启动 VS 后,问题就解决了。
          • 这对我来说适用于 Visual Studio 2015 - 用 14.0 替换 12.0
          猜你喜欢
          • 2015-11-24
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-01-20
          • 1970-01-01
          • 2013-12-13
          • 2016-03-05
          相关资源
          最近更新 更多