Follow us on X (Twitter)  Like us on Facebook  Connect with us on LinkedIn  Subscribe to our YouTube Channel  Subscribe to our WhatsApp Group

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 (x86)\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 (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"

  1. Now enter the following commands, one after another:

gacutil /if Microsoft.VisualStudio.Shell.15.0.dll
gacutil /if Microsoft.VisualStudio.Shell.Interop.11.0.dll

  1. 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.

 

Have a question? Or, a comment? Let's Discuss it below...

dhgate

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.