'CascadePackage' 包未正确加载

The 'CascadePackage' package did not load correctly

我刚刚对 VS2019(16.9.0) 进行了更新,现在我收到了这条消息。 (实际上在两台机器上)。重新启动不能解决问题。

什么是级联包? 我可以只对对话框说 就可以了吗?

另外...它提到要检查的文件...已不存在,它所在的目录也已不存在。

我确实在最新的 ActivityLog.xml

中找到了这一行
  <entry>
    <record>894</record>
    <time>2021/03/05 13:52:21.259</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [CascadePackage]Source: &apos;System.ComponentModel.Composition&apos; Description: The composition produced multiple composition errors, with 3 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.&#x000D;&#x000A;&#x000D;&#x000A;1) No exports were found that match the constraint: &#x000A;&#x0009;ContractName&#x0009;Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&#x000A;&#x0009;RequiredTypeIdentity&#x0009;Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot set import &apos;Microsoft.VisualStudio.Cascade.CascadePackage.JoinWorkspaceCommandHandler (ContractName=&quot;Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&quot;)&apos; on part &apos;Microsoft.VisualStudio.Cascade.CascadePackage&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.Cascade.CascadePackage.JoinWorkspaceCommandHandler (ContractName=&quot;Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&quot;) --&gt;  Microsoft.VisualStudio.Cascade.CascadePackage&#x000D;&#x000A;&#x000D;&#x000A;2) No exports were found that match the constraint: &#x000A;&#x0009;ContractName&#x0009;Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&#x000A;&#x0009;RequiredTypeIdentity&#x0009;Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot set import &apos;Microsoft.VisualStudio.Cascade.CascadePackage.ShareWorkspaceCommandHandler (ContractName=&quot;Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&quot;)&apos; on part &apos;Microsoft.VisualStudio.Cascade.CascadePackage&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.Cascade.CascadePackage.ShareWorkspaceCommandHandler (ContractName=&quot;Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&quot;) --&gt;  Microsoft.VisualStudio.Cascade.CascadePackage&#x000D;&#x000A;&#x000D;&#x000A;3) No exports were found that match the constraint: &#x000A;&#x0009;ContractName&#x0009;Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&#x000A;&#x0009;RequiredTypeIdentity&#x0009;Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot set import &apos;Microsoft.VisualStudio.Cascade.CascadePackage.ClientService (ContractName=&quot;Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&quot;)&apos; on part &apos;Microsoft.VisualStudio.Cascade.CascadePackage&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.Cascade.CascadePackage.ClientService (ContractName=&quot;Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&quot;) --&gt;  Microsoft.VisualStudio.Cascade.CascadePackage&#x000D;&#x000A;&#x000D;&#x000A;</description>
    <guid>{D86E17D6-7FC7-47F4-9259-21748EDFF93B}</guid>
    <hr>80131500</hr>
    <errorinfo></errorinfo>
  </entry>

这似乎是由 LiveShare 引起的。 来自 Visual Studio Developer Community

只需搜索

The 'CascadePackage' package did not load correctly

关于我的两个问题:

On one machine...the error went away by starting VisualStudio.

On another machine I went into Tools->Get Tools and Features...
Click on Individual components search for Live Share. Uncheck it. Restart VS.

Go back into Tools->Get Tools and Features...
Click on Individual components search for Live Share. Check it back.

有关 ActivityLog 的更多信息...
Visual Studio 在更新时使用 /log 选项。这将创建 ActivityLog.xml。
此处有更多内容 /Log (devenv.exe) 您也可以自己做。

ActivityLog.xml的描述部分会列出问题所在。这是 OP 中原始消息的经过编辑的细分。

<entry>
    <record>894</record>
    <time>2021/03/05 13:52:21.259</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [CascadePackage]Source: &apos;System.ComponentModel.Composition&apos; 
    Description: The composition produced multiple composition errors, with 3 root causes. 
    The root causes are provided below. 
    Review the CompositionException.Errors property for more detailed information.&#x000D;&#x000A;&#x000D;&#x000A;
    1) No exports were found that match the constraint: &#x000A;&#x0009;
    ContractName&#x0009;Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&#x000A;&#x0009;
    RequiredTypeIdentity&#x0009;Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&#x000D;&#x000A;&#x000D;&#x000A;
    Resulting in: Cannot set import &apos;
    Microsoft.VisualStudio.Cascade.CascadePackage.JoinWorkspaceCommandHandler (ContractName=&quot;
    Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&quot;)&apos; on part &apos;
    Microsoft.VisualStudio.Cascade.CascadePackage&apos;.&#x000D;&#x000A;
    Element: Microsoft.VisualStudio.Cascade.CascadePackage.JoinWorkspaceCommandHandler (ContractName=&quot;
    Microsoft.VisualStudio.Cascade.Commands.IJoinCommandLineHandler&quot;) --&gt;  
    Microsoft.VisualStudio.Cascade.CascadePackage&#x000D;&#x000A;&#x000D;&#x000A;
    2) No exports were found that match the constraint: &#x000A;&#x0009;
    ContractName&#x0009;Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&#x000A;&#x0009;
    RequiredTypeIdentity&#x0009;
    Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&#x000D;&#x000A;&#x000D;&#x000A;
    Resulting in: Cannot set import &apos;
    Microsoft.VisualStudio.Cascade.CascadePackage.ShareWorkspaceCommandHandler (ContractName=&quot;
    Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&quot;)&apos; on part &apos;
    Microsoft.VisualStudio.Cascade.CascadePackage&apos;.&#x000D;&#x000A;
    Element: Microsoft.VisualStudio.Cascade.CascadePackage.ShareWorkspaceCommandHandler (ContractName=&quot;
    Microsoft.VisualStudio.Cascade.Commands.IShareCommandLineHandler&quot;) --&gt;  
    Microsoft.VisualStudio.Cascade.CascadePackage&#x000D;&#x000A;&#x000D;&#x000A;
    3) No exports were found that match the constraint: &#x000A;&#x0009;ContractName&#x0009;
    Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&#x000A;&#x0009;RequiredTypeIdentity&#x0009;
    Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&#x000D;&#x000A;&#x000D;&#x000A;
    Resulting in: Cannot set import &apos;
    Microsoft.VisualStudio.Cascade.CascadePackage.ClientService (ContractName=&quot;
    Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&quot;)&apos; on part &apos;
    Microsoft.VisualStudio.Cascade.CascadePackage&apos;.&#x000D;&#x000A;
    Element: Microsoft.VisualStudio.Cascade.CascadePackage.ClientService (ContractName=&quot;
    Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientService&quot;) --&gt;  
    Microsoft.VisualStudio.Cascade.CascadePackage&#x000D;&#x000A;&#x000D;&#x000A;
    </description>
    <guid>{D86E17D6-7FC7-47F4-9259-21748EDFF93B}</guid>
    <hr>80131500</hr>
    <errorinfo></errorinfo>
  </entry>

要修复此错误,请更新至Visual Studio 16.9.2 - 它已被修复。 Release Notes:

中也提到了

Fixed an issue causing an error message indicating the CascadePackage did not load correctly

我使用的是 16.9.4 版本,但仍然遇到此问题。但是,我可以通过启用或禁用 LiveShare 扩展(扩展 >> 管理扩展 >> 已安装 >> Live Share),然后是最近的 VS 来解决这个问题。

如果这不起作用,请尝试恢复到以前的版本,或更新它。

有时我必须多次尝试以上操作才能使其正常工作。

通常在升级 Live Share 扩展并重新启动 Visual Studio 几次(通常至少三次)后,此错误会自行消失。

但是,有时这不起作用。在这些情况下,按照描述手动清理 MEF 缓存(通过删除 %localappdata%\Microsoft\VisualStudio.0\ComponentModelCache 的内容),或通过扩展 Clear MEF Component Cache 使其自动化已解决问题。

显然,如果您不想使用 Live Share,您可以从“扩展”菜单中禁用它,Visual Studio 甚至不会加载包。

更新:我注意到即使禁用 Live Share 有时也会出现此问题。在我的所有(许多)尝试中,切换它解决了清除 MEF 缓存后的启动问题。