none
Visual Studio 2010 - Add COM Reference - Missing tlb from list

    Question

  • I am trying to add a reference to a COM (tlb) in Visual Studio 2010. When I go to the Add Reference dialog and the COM tab, the assembly is not listed. If I do this in Visual Studio 2013 or 2015 it is there. The tlb installs and registers, I can see it in OleViewer. I am testing in all cases with a new WinForms (VB) application and .NET 4 (Full).

    What would stop 2010 from seeing or listing it?

    Monday, May 02, 2016 2:33 PM

Answers

  • Hi fwk,

    According to the part of "To display an assembly in the Add Reference dialog box" in following MSDN article, the assemblies that listed in Add Reference dialog box are based on your Operating System.

    https://msdn.microsoft.com/en-us/library/wkze6zky(v=vs.100).aspx

    So if you want some assemblies that not listed in Add Reference dialog box, please set registry keys that specify the location of assemblies to display as the steps in above link.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 03, 2016 4:49 AM
    Moderator

All replies

  • I am trying to add a reference to a COM (tlb) in Visual Studio 2010. When I go to the Add Reference dialog and the COM tab, the assembly is not listed. If I do this in Visual Studio 2013 or 2015 it is there. The tlb installs and registers, I can see it in OleViewer. I am testing in all cases with a new WinForms (VB) application and .NET 4 (Full).

    What would stop 2010 from seeing or listing it?

    If you are adding a reference through the VS IDE, that suggests to me that your client software is one of the .NET languages such as C# or VB.NET. If that is the case, you need to make sure that the CPU selected matches that of the COM server. In other words, if the COM DLL is built to run on x86, then your C# (or VB.NET) must also be built as x86.

    For C++ clients, you don't add a reference at all, but instead use CoCreateInstanceEx() to instantiate the COM object.

    • Edited by Brian Muth Monday, May 02, 2016 3:26 PM
    Monday, May 02, 2016 3:25 PM
  • I tried the target CPU configuration already. The tlb is a 64 bit assembly. The client app is VB.NET. I cycled through the 3 target option x86, x64 and Any CPU just to be sure. In VS2013/15, VS sees it with the default Any CPU configuration, I simply do new WinForms (VB) project and then go to the add reference dialog and it shows up. I assume that VS is just reading through the registry at HKEY_CLASSES_ROOT\TypeLib.

    Background:

    The API has been updated from 32 to 64 bit. The client project I have is in VS2010 and I am trying to upgrade to 64 bit accordingly. When I could not see it in the project, I took a step back and made a new basic project to see if the issue was project related and clearly it is not. Then I tried repeating it in the other versions of VS I have installed. Updating the project to VS2015 means making a new installer since the deployment project is no longer supported and that will come at a later phase. So I would like to stick with VS2010 for the first phase.

    Monday, May 02, 2016 3:56 PM
  • Playing around, I changed the win64 key for the tlb path of the registry for this to "win32". It immediately showed up in VS2010. I change it back to "win64" and it disappears. Based on some web searches it appears that VS2010 may not be able to reference 64 bit dlls via the add reference dialog. Does anyone know if that is true? I can't find anything "official" on MSDN about it.
    Monday, May 02, 2016 6:25 PM
  • Hi fwk,

    According to the part of "To display an assembly in the Add Reference dialog box" in following MSDN article, the assemblies that listed in Add Reference dialog box are based on your Operating System.

    https://msdn.microsoft.com/en-us/library/wkze6zky(v=vs.100).aspx

    So if you want some assemblies that not listed in Add Reference dialog box, please set registry keys that specify the location of assemblies to display as the steps in above link.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 03, 2016 4:49 AM
    Moderator