none
Absolute path for COM Reference RRS feed

  • Question

  • Hi everyone,

    I'm currently working on a migration from VB6 to VB.Net of a project which uses 2 COM References :

    1. ActiveSocket 3.1 Type Library : C:\Program Files\ActiveXperts\ActiveSocket\Program\ASocket.dll
    2. Microsoft XML, v4.0 : C:\WINDOWS\system32\msxml4.dll

    The project worked fine in VB6 on computers which already have these DLL on "Program Files" and "System32" directory.

    Now, when I add the references in Visual Studio 2010, it copies the DLL and renames them in the release folder of the project :

    1. D:\MyProject\obj\Release\Interop.ASOCKETLib.dll
    2. D:\MyProject\obj\Release\Interop.MSXML2.dll

    Those files have different size from the original. It changes from 1.3 Mb to 180 Kb for example.

    If I publish the VB.Net project in concerned computers without the copied DLL, it fails to find the DLL.

    I have spend a full day to find a solution on Internet so I give some further informations :

    •  None of the DLL is registered in GAC (I can't change that)
    •  The .vbproj file has no "HintPath" and looks like this :

    <ItemGroup>
        <COMReference Include="ASOCKETLib">
          <Guid>{B52B14BA-244B-4006-86E0-2923CB69D881}</Guid>
          <VersionMajor>1</VersionMajor>
          <VersionMinor>0</VersionMinor>
          <Lcid>0</Lcid>
          <WrapperTool>tlbimp</WrapperTool>
          <Isolated>False</Isolated>
          <EmbedInteropTypes>True</EmbedInteropTypes>
        </COMReference>
        <COMReference Include="MSXML2">
          <Guid>{F5078F18-C551-11D3-89B9-0000F81FE221}</Guid>
          <VersionMajor>4</VersionMajor>
          <VersionMinor>0</VersionMinor>
          <Lcid>0</Lcid>
          <WrapperTool>tlbimp</WrapperTool>
          <Isolated>False</Isolated>
          <EmbedInteropTypes>True</EmbedInteropTypes>
        </COMReference>
      </ItemGroup>

    • The VB6 (.vbp) file looked like this :

    Reference=*\G{F5078F18-C551-11D3-89B9-0000F81FE221}#4.0#0#C:\WINDOWS\system32\msxml4.dll#Microsoft XML, v4.0
    Reference=*\G{B52B14BA-244B-4006-86E0-2923CB69D881}#1.0#0#C:\Program Files\Fichiers communs\ActiveXperts\ASocket.dll#ActiveSocket 3.1 Type Library

    • I have added the paths in the "References Paths" but it doesn't change anything.

    I really don't understand why Visual Studio 2010 can't use absolute paths and how to force it to use them.

    Please help me ! :)



    • Edited by DrunkyDev Friday, November 9, 2012 9:32 AM
    Friday, November 9, 2012 9:22 AM

Answers

  • Thanks for your response !

    I didn't know what Interop files are. Too bad .Net has to use them.

    As I can't publish extra files, I change the project not to use the DLL.

    • Marked as answer by DrunkyDev Friday, November 9, 2012 2:53 PM
    • Edited by DrunkyDev Friday, November 9, 2012 2:54 PM
    Friday, November 9, 2012 2:53 PM

All replies

  • First, the generated Interop files are not copies of your COM libraries.  They contain glue routines required to communicate with the existing COM modules.  So for your program to work, you need to deploy both Interop's and the COM libraries.

    The simplest approach is to dump the Interop libraries in the same folder as your EXE and register the COM libraries as you have done in the past.

    As a side note, if your use of XML isn't too extensive, I'd drop MSXML4 in favor of the .NET XML classes.  This will leave you with one less COM component to deal with.


    This signature unintentionally left blank.

    Friday, November 9, 2012 12:59 PM
  • Thanks for your response !

    I didn't know what Interop files are. Too bad .Net has to use them.

    As I can't publish extra files, I change the project not to use the DLL.

    • Marked as answer by DrunkyDev Friday, November 9, 2012 2:53 PM
    • Edited by DrunkyDev Friday, November 9, 2012 2:54 PM
    Friday, November 9, 2012 2:53 PM