none
COM interop assemblies and PrimaryInteropAssemblyCodeBase RRS feed

  • Question

  • We have a pretty big issue with registering 32-bit and 64-bit primary interop assemblies and maintaining IntelliSense support. We ship both 32-bit and 64-bit COM in-proc servers and register the corresponding 32-bit and 64-bit PIAs.  We use the PrimaryInteropAssemblyCodeBase value in the TypeLib entry to point to the location of our PIAs on disk.  This PrimaryInteropAssemblyCodeBase value is required to get Visual Studio to locate the XML IntelliSense file for rendering IntelliSense for that PIA -- you point the code base at the DLL and put the XML file next to it and Visual Studio renders the content.

    The problem is that with Windows 7, the TypeLib section of the registry is shared, so you can only point PrimaryInteropAssemblyCodeBase at either the 32-bit or 64-bit PIA (not both).  If you point it at the 32-bit PIA, then building 64-bit apps using that PIA fails in Visual Studio (and vice-versa if you use the 64-bit PIA location).  If you don't use the PrimaryInteropAssemblyCodeBase value at all, then Visual Studio will resolve to the correct PIA via the GAC and builds work -- but IntelliSense is *not* rendered because the XML IntelliSense file obviously is not (typically) installed in the GAC.

    Building the PIAs as "Any CPU" does work, but it feels "wrong" since PIAs *really* are, by definition, bitness-dependent.  This seems fundamentally broken and I'm wondering how others have not come across this.

    Any help or insights are much appreciated.


    Kirk Fertitta

    Friday, February 14, 2014 1:44 AM

All replies

  • Hello,

    Being confused about what you want to ask. Could you please state your question more clarifily as how to do …?

    Regards.


    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.

    Monday, February 17, 2014 6:48 AM
    Moderator
  • Hi Fred,

    Thanks for the reply, and sorry if it was unclear.  Not sure how to clarify though.  Was there a specific part that didn't make sense?

    Essentially the PrimaryInteropAssemblyCodeBase value that must appear in the registry for interop assemblies needs to point to the 32-bit interop assembly in the 32-bit registry hive and to the 64-bit interop assembly from the 64-bit registry hive.  But, that value lives in the Typlib section of the registry which is shared between 32-bit and 64-bit, so there is seemingly no way to have it point at both places.  So, you have to pick either the 32-bit or 64-bit version of your interop assembly, which means when you build against it in Visual Studio, you can't build both 32-bit and 64-bit apps.  If you don't use the PrimaryInteropAssemblyCodeBase value at all, then IntelliSense doesn't work for items in your interop assembly.  If you build your interop assemblies Any CPU, then everything can be made to work, but that seems fundamentally wrong.

    Hope this is clearer.


    Kirk Fertitta

    Monday, February 17, 2014 7:05 AM
  • Hello,

    As far as I know, If we want to create component for use by both x86 and x64 then we need to either create a pair of dlls one built for x86 and the other for x64 and register both in their appropriate parts of the registry. The regsrv32.exe in the System32 folder will perversely register the x64 component and the regsrv32.exe in the SysWOW64 folder will register the x86 component.

    Regards.


    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, February 18, 2014 8:20 AM
    Moderator
  • Hello Fred,

    Thank you for taking the time to reply, however I do not believe you are understanding the issue (at all, I'm afraid).  As a moderator, are you perhaps able to forward the issue to someone with a bit more experience in the area of interop assemblies please?  That would be very much appreciated.

    Thank you again in advance.


    Kirk Fertitta

    Tuesday, February 18, 2014 3:59 PM
  • Hello,

    Sorry for misunderstanding you and as you said, I am trying to involve some who is experienced to pay attention to this issue.

    Thanks for your understanding.

    Regards.


    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.

    Wednesday, February 19, 2014 1:20 AM
    Moderator
  • Hi Fred,

    Just wanted to check in and see if you were able to get somebody involved in this case.  As I indicated, it surely seems like something many others would have come across.

    Thanks in advance.


    Kirk Fertitta

    Tuesday, April 1, 2014 4:14 PM
  • Any updates here please? We'd really like to understand how others have dealt with this issue.

    Kirk Fertitta

    Wednesday, April 23, 2014 4:17 PM
  • Sure would love a response here.  Been a long time since I posted this question.  Fred had said he was looking at finding an experienced person to respond here.

    Kirk Fertitta

    Wednesday, October 15, 2014 4:00 PM