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

46 Points
13 Posts

When I try to Add a reference in Visual Studio Community 2019 , I got this error:

error HRESULT E_Fail has been returned from a call to a COM Component

First time I got following error:


Following is logged in activity log:

    <time>2020/05/09 14:25:04.299</time>
    <description>CreateInstance failed for package [ReferenceManagerPackage]Source: &apos;mscorlib&apos; Description: Could not load type &apos;Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2&apos; from assembly &apos;Microsoft.VisualStudio.Shell.Interop.11.0, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;.&#x000D;&#x000A;System.TypeLoadException: Could not load type &apos;Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2&apos; from assembly &apos;Microsoft.VisualStudio.Shell.Interop.11.0, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;.&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)</description>
    <hr>80004005 - E_FAIL</hr>
Views: 2858
Total Answered: 1
Total Marked As Answer: 1
Posted On: 09-May-2020 05:17

Share:   fb twitter linkedin
Please, share/see activitylog.xml, here you can find the exact error
 - sam  09-May-2020 21:30
updated Sam, thanks.
 - sid  09-May-2020 21:33
152 Points
66 Posts

As we can see assembly


has issue to load.

To resolve it, follow following steps:

  1. First of all, close all the instances of Visual Studio.
  2. Open the Developer Command Prompt for VS 2019 with admin privileges, as shown in the following screenshot:
  3. Now, navigate to the "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\ Common7\IDE\ PublicAssemblies"
    1. Enter the following command in the console window:
      CD "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies"​
    2. Now enter the following command:
      gacutil -i Microsoft.VisualStudio.Shell.11.0.dll​
  4. Once you get the Assembly successfully added to the cache message in the console window (as shown in the following screenshot), start the Visual Studio 2019 instance.
  5. Now open your project and try to add the assembly reference. It will work this time.
Posted On: 09-May-2020 21:55
Thanks. It works for me.
 - sid  10-May-2020 03:10
 Log In to Chat