SoumabhaSarkar-7746 avatar image
0 Votes"
SoumabhaSarkar-7746 asked AnnaXiu-MSFT commented

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

We are distributing one dll along with our extension which is present in location once the extension is installed. We need to implement a functionality where this dll has to be added in the reference when a generate a custom class to any console/winform project. We tried to use VSLangProj.References.Add("xyz.dll") but we are getting exception

Error HRESULT E_FAIL has been returned from a call to a COM component
at VSLangProj.References.Add(String bstrPath)

According to the MS documentation, (

The development environment searches for the name in the following order, stopping as soon as a match is found:

In the project hierarchy.

In the references search path, which is a project-level setting. For more information, see ReferencePath.

In the set of directories the component picker uses when enumerating references. This set of directories is stored in the registry during installation.

Each reference is resolved when a project is loaded. Resolution also occurs on a new reference when the bstrPath parameter to the Add method is something other than a full path.

We have made entry for this dll in the pkgdef file


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, which version of Visual Studio are you using? Please close all instances of VS and delete the .vs folder to try again.

0 Votes 0 ·

0 Answers