kunal-chowdhury.com

Unable to add reference in Visual Studio 2017 - Error HRESULT E_FAIL has been returned from a call to a COM component



While adding assembly reference in Visual Studio 2017, if you are facing the following error message: "Error HRESULT E_FAIL has been returned from a call to a COM component", this could be due to ReferenceManagerPackage failed to load. If you encountered this issue, here's a quick solution for you to resolve it.

 

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

 

If you are facing the error message: "Error HRESULT E_FAIL has been returned from a call to a COM component" while trying to add assembly references in your .NET project, follow the steps mentioned below:

  1. First of all, close all the instances of Visual Studio.
  2. Open the Developer Command Prompt for VS 2017 with admin privileges, as shown in the following screenshot:

Open the Visual Studio 2017 Developer Command Prompt with Admin privileges

  1. Now, navigate to the "C:\Program Files\Microsoft Visual Studio\2017\[EDITION]\Common7\IDE\PublicAssemblies" by entering the following command in the console window. Replace [EDITION] with the Visual Studio edition that you are using. It could be "Professional", "Enterprise" or "Community". If you are using Visual Studio 2017 Professional edition, the command will be:
    CD "C:\Program Files\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
  2. Now enter the following command:
    gacutil -i Microsoft.VisualStudio.Shell.15.0.dll
  3. 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 2017 instance.

Successful installation of Microsoft.VisualStudio.Shell.15.0.dll

 

Now open your project and try to add the assembly reference. It will work this time. Do let me know on Twitter, if you are still facing the same problem.

 

Don't forget to checkout my books: Mastering Visual Studio 2019, Mastering Visual Studio 2017 and Windows Presentation Foundation Development Cookbook. You can find them at the following URL.

 

 


Kunal Chowdhury
If you have come this far, it means that you liked what you are reading (Unable to add reference in Visual Studio 2017 - Error HRESULT E_FAIL has been returned from a call to a COM component).

Why not reach little more and connect with me directly on Twitter, Facebook and LinkedIn. I would love to hear your thoughts and opinions.

Authored Books: