Unable to add reference in Visual Studio 2017 - Error HRESULT E_FAIL has been returned from a call to a COM component - If you are facing this error, here's the solution for you.
-
Published by Kunal Chowdhury
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.

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:

CD "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
gacutil /if Microsoft.VisualStudio.Shell.15.0.dll
gacutil /if Microsoft.VisualStudio.Shell.Interop.11.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.
Solution Architect & Former Microsoft MVP
Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.
He publishes technical articles on Kunal-Chowdhury.com.