错误hresult e_fail已从添加引用中的com组件返回到com组件



在VS-2017中,单击"添加参考"时我有一个错误:

"Error HRESULT E_FAIL has been returned from a call to a COM component."

由于我无法

  1. 添加任何参考和
  2. 通过db_first方法更新我的数据库

在Windows的最后一次更新之后,此问题开始发生。

什么对我有用

  1. 打开带有管理特权的VS 2019的开发人员命令提示
  2. 输入开发人员命令提示符

CD C: Program Files(X86) Microsoft Visual Studio 2019 Enterprise Enterprise common7 IDE prublicAssemblies

您的路径可能有所不同,所以检查

  1. 输入开发人员命令提示

gacutil -i microsoft.visualstudio.shell.interop.11.0.dll

它应该重建,您现在可以添加参考!

此链接对我有很大帮助:

添加参考升级错误:错误hresult e_fail已从呼叫返回到com组件

步骤:

  1. 开放&quot'开发人员命令提示vs vs 2017''作为管理员

  2. CD进入&quot'c: program文件(x86) Microsoft VisualStudio 2017 Professional common7 ide publicAssemblies&quot'

  3. 运行" gacutil-i microsoft.visualstudio.shell.interop.11.0.dll;在此之后,"开发者命令提示"one_answers"开发者命令"提示为2017年。作为管理员

  4. CD&quot" c: program文件(x86) Microsoft SDK Windows Windows V10.0A bin bin netfx 4.6.1工具 x64

  5. 运行 - >gacutil.exe/i c: program Files(x86) Microsoft视觉的Studio 2017 Enterprise common7 iDe publicAssemblies Microsoft.visualstudio.shell.shell.interop.11.0.dll&quot

    Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
    Copyright (c) Microsoft Corporation. All rights reserved.
    Assembly successfully added to the cache
    

重新启动您的PC可以解决问题

我的问题发生在我尝试打开新克隆的解决方案(以前是在VS2019中开发的),并在VS2022中遇到了很多问题,其中大多数参考都在AutoMapper上失败了上述错误。我复制了从解决方案备份,重建并开始在VS2022中工作的问题。

对于vs Enterprise,它可以工作(在开发人员命令提示中运行):C: Program Files(X86) Microsoft SDK Windows Windows V10.0A bin bin netfx 4.7.1工具 x64> gacutil.exe/i c:c:c: program文件(x86)Enterprise common7 IDE publicAssemblies Microsoft.visualstudio.shell.shell.interop.11.0.dll

什么对我有用

打开带有管理特权的VS 2019的开发人员命令提示输入开发人员命令提示CD C: Program Files(X86) Microsoft Visual Studio 2019 Community Common7 IDE PublicAssemblies

您的路径可能有所不同,所以检查

键入开发人员命令提示gacutil -i microsoft.visualstudio.shell.interop.11.0.dll

Microsoft(R).NET全局汇编缓存实用程序。版本4.0.30319.0版权(C)Microsoft Corporation。保留所有权利。

汇编成功添加到缓存在此处输入图像描述它应该重建,您现在可以添加引用!

最新更新