vs2017添加引用报错 对COM组件的调用返回了错误HRESULT E_FAIL - 小众知识

vs2017添加引用报错 对COM组件的调用返回了错误HRESULT E_FAIL

2013年01月27日 14:18:05 苏内容
  标签: vs2017/COM

vs2017添加引用的时候报错 对COM组件的调用返回了错误HRESULT E_FAIL



1、运行 VS2017的开发人员命令提示符

2、cd C:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDEPublicAssemblies

3、gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll




When I try to Add a reference in Visual Studio 2017, I get this error: error HRESULT E_Fail has been returned from a call to a COM Component

Repaire with Visual Studio Installer doesn't fix the problem.​

Just experienced this issue. The first time you get this error message you get a window with a reference to the ActivityLog.xml that contains information about the underlying error. If you click No the error gets suppressed and replaced with a generic "Error HRESULT E_FAIL has been returned from a call to a COM component".

I only realised this because we got the message again after updating VS. This is what we did to solve it:

Go to your `C:Users{USER}AppDataRoamingMicrosoftVisualStudio` folder, and you should find a folder in there called `15_{id}`. Open it, and have a look at the `ActivityLog.xml`. If you have a look in it you should find the error in there and the library that's causing it. In my case it was caused by `Microsoft.visualstudio.shell.interop.IVsReferenceManager2` within the `Microsoft.VisualStudio.Shell.Interop.11.0.dll` library.

This post helped me solve the issue then: https://social.msdn.microsoft.com/Forums/officeocs/en-US/4eea5785-0a83-4389-89e3-209a5a4432c0/referencemanagerpackage-fails-to-install-vs-2017-community-edition?forum=vssetup

#1 Open "Developer Command Prompt for VS 2017" as Admin

#2 CD into "C:Program Files (x86)Microsoft Visual Studio2017ProfessionalCommon7IDEPublicAssemblies"

#3 Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"

After a restart, it all worked well.