Results 1 to 20 of 20

Thread: .Net Com+ DLL in VB6 - RegFree

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    47

    .Net Com+ DLL in VB6 - RegFree

    I would like to hear your opinion/information about using a .Net Com+ DLL in VB6 without registration.

    This would be the DLL:
    https://www.easyxls.com/component-excel-library

    This DLL requires registration with the "regsvcs" file.

    I tried many things described here in the forum (Manifest / SxS) a while ago, but I was unsuccessful... I'm starting to see this again...

    Thanks,
    Thiago

  2. #2
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    Just to clarify, is this a .net app and that dll is vb6?

  3. #3
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    Looking on their site it looks like they have a .net version. Why can't you use that?

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,469

    Re: .Net Com+ DLL in VB6 - RegFree

    It's the other way around.
    The application is VB6 and the DLL is .net

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    47

    Re: .Net Com+ DLL in VB6 - RegFree

    Exactly: The application is written in VB6, and the DLL is a .NET assembly.

    The component we have is the COM+ version (not a regular .NET class library), and it was specifically designed for VB6 interoperability.

    However, the issue we're facing with regfree usage seems to be related to the fact that this is a COM+ component, not a traditional COM DLL.

  6. #6
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,829

    Re: .Net Com+ DLL in VB6 - RegFree

    > However, the issue we're facing with regfree usage seems to be related to the fact that this is a COM+ component, not a traditional COM DLL.

    You have to explain these "issues" in depth. There is not that much difference between "COM+ component" and "traditional COM DLL" besides activation and transaction participation.

    One is out-of-process (COM+) using a surrogate host process so regfree activation is out of the question. This sounds like an "insurmountable issue" but I might be missing something with COM+ activation you are using.

    cheers,
    </wqw>

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    47

    Re: .Net Com+ DLL in VB6 - RegFree

    Hi wqweto,

    I'm trying to make it work using a manifest file, based on examples I found in forum and online.

    I've tested a few variations like this one:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <assemblyIdentity type="win32" name="Project1" version="1.0.0.0" />
    
      <!-- Dependency on .NET CLR -->
      <dependency>
        <dependentAssembly>
          <assemblyIdentity
            name="clr"
            version="4.0.30319.0"
            publicKeyToken="b77a5c561934e089"
            processorArchitecture="x86" />
        </dependentAssembly>
      </dependency>
    
      <!-- Common controls -->
      <dependency>
        <dependentAssembly>
          <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*" />
        </dependentAssembly>
      </dependency>
    
      <!-- EasyXLS .NET COM Interop -->
      <file name="EasyXLS.dll">
        <comClass
          clsid="{ED783240-17F3-3709-96DE-93DCA09DB1BF}"
          progid="EasyXLS.ExcelDocument"
          threadingModel="Apartment" />
      </file>
    </assembly>
    Also, here's the VB6 code I'm using to test the activation:
    Code:
    Private Type tagInitCommonControlsEx
       lngSize As Long
       lngICC As Long
    End Type
    Private Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As tagInitCommonControlsEx) As Boolean
    
    Public Sub Main()
       Dim iccex As tagInitCommonControlsEx
    
       With iccex
          .lngSize = LenB(iccex)
          .lngICC = &H200 ' ICC_USEREX_CLASSES
       End With
    
       On Error Resume Next
       InitCommonControlsEx iccex
       On Error GoTo 0
    
       ' Test
       Dim a As Object
       Set a = CreateObject("EasyXLS.ExcelDocument")
       MsgBox Not a Is Nothing
    End Sub
    But I get the following error messages when running the test:

    The application has failed to start because its side-by-side configuration is incorrect.
    OR
    ActiveX component can't create object

  8. #8
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    create a build output folder with Project.exe, EasyXLS.dll and this file

    Project1.manifest

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly
        xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
        <assemblyIdentity type="win32" name="Project1" version="1.0.0.0" />
        <dependency>
            <dependentAssembly>
                <assemblyIdentity name="EasyXLS" publicKeyToken="632c31013494909a" version="9.1.0.0" processorArchitecture="msil" />
            </dependentAssembly>
        </dependency>
    </assembly>
    Then run this

    Code:
    & mt -nologo -manifest Project1.manifest -outputresource:Project1.exe;#1
    Add the below the the manifest only if you want it to be able to pick up modern windows themes

    Code:
    <!-- Common controls -->
        <dependency>
            <dependentAssembly>
                <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*" />
            </dependentAssembly>
        </dependency>
    Last edited by rjsnipe; Apr 14th, 2025 at 11:29 AM.

  9. #9
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,829

    Re: .Net Com+ DLL in VB6 - RegFree

    I was suspecting there is no COM+ in sight, neither in manifest nor in code.

    Try dependentAssembly tag as already suggested. This is the way to "reference" the manifest embedded in the .Net DLL.

    Btw, I'm not sure if these DLL manifests are automatically generated on build for COM interop classes but there is a way to recreate and embed these with mt.exe

    cheers,
    </wqw>

  10. #10

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    47

    Re: .Net Com+ DLL in VB6 - RegFree

    Hi rjsnipe and wqweto,

    Thank you both for your input.

    I generated the Project1.manifest as follows:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly
        xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
        <assemblyIdentity type="win32" name="Project1" version="1.0.0.0" />
        <dependency>
            <dependentAssembly>
                <assemblyIdentity name="EasyXLS" publicKeyToken="632c31013494909a" version="9.0.0.0" processorArchitecture="msil" />
            </dependentAssembly>
        </dependency>
    </assembly>
    VB6 App (Project1.exe):
    Code:
    Public Sub Main()
       Dim a As Object
       
       MsgBox "Start"
       
       Set a = CreateObject("EasyXLS.ExcelDocument")
       MsgBox Not a Is Nothing
    End Sub
    I then ran:
    Code:
    mt -nologo -manifest Project1.manifest -outputresource:Project1.exe;#1
    However, when executing the app, I get the following error:
    “The application has failed to start because its side-by-side configuration is incorrect.”
    ( The error occurs immediately — the initial "Start" message box doesn't even appear )



    Quote Originally Posted by wqweto View Post
    I was suspecting there is no COM+ in sight, neither in manifest nor in code.

    Try dependentAssembly tag as already suggested. This is the way to "reference" the manifest embedded in the .Net DLL.

    Btw, I'm not sure if these DLL manifests are automatically generated on build for COM interop classes but there is a way to recreate and embed these with mt.exe

    cheers,
    </wqw>
    Just to clarify, the company behind EasyXLS refers to this version of the DLL as “COM+”:
    https://www.easyxls.com/component-excel-library

    And we use regsvcs.exe to register the assembly, as described here:
    https://www.easyxls.com/manual/troub...ct-failed.html
    ( I’ve always registered components using regsvr32 )

  11. #11

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    47

    Re: .Net Com+ DLL in VB6 - RegFree

    Adding type="win32" to the manifest fixed the side-by-side activation issue.
    Here's the updated Project1.manifest:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
        <assemblyIdentity type="win32" name="Project1" version="1.0.0.0" />
        
        <dependency>
            <dependentAssembly>
                <assemblyIdentity 
                    name="EasyXLS" 
                    publicKeyToken="632c31013494909a" 
                    version="9.0.0.0" 
                    processorArchitecture="msil"
                    type="win32" />
            </dependentAssembly>
        </dependency>
    </assembly>
    Now the application starts, but I'm getting this error:

    "Run-time error '429': ActiveX component can't create object"

  12. #12
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,829

    Re: .Net Com+ DLL in VB6 - RegFree

    > And we use regsvcs.exe to register the assembly, as described here:

    Oh, so it's some .Net development I'm not qualified to comment on.

    I highly doubt you'll be able to use regfree activation with this component if it's registered under COM+. I would first try running it as normal in-proc COM server as it's hard to fathom what gains using it under COM+ from a *single* threaded evironment like VB6 are expected.

    Btw, another remote option is that you might be able to manually simulate what COM+ does by (manually) running dllhost.exe (or whatever) with just the right parameters so that it hosts your DLL and registers it's class factories in ROT but I've never done this or heard anyone here doing it.

    cheers,
    </wqw>

  13. #13

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    47

    Re: .Net Com+ DLL in VB6 - RegFree

    Quote Originally Posted by wqweto View Post
    > And we use regsvcs.exe to register the assembly, as described here:

    Oh, so it's some .Net development I'm not qualified to comment on.

    I highly doubt you'll be able to use regfree activation with this component if it's registered under COM+. I would first try running it as normal in-proc COM server as it's hard to fathom what gains using it under COM+ from a *single* threaded evironment like VB6 are expected.

    Btw, another remote option is that you might be able to manually simulate what COM+ does by (manually) running dllhost.exe (or whatever) with just the right parameters so that it hosts your DLL and registers it's class factories in ROT but I've never done this or heard anyone here doing it.

    cheers,
    </wqw>
    Thanks anyway, wqweto — I really appreciate your time and input.

  14. #14
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    It looks like just a normal .net com dll.

    Can you confirm the line in your code that throws the error?

  15. #15
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    When i say looks like, what i mean is, it is a normal .net framework com dll. It does not use regsvr32 to register, it uses regasm, that supplied RegSvcs.exe must be made by them to do the registration and likely just calls regasm. Which is totally confusing.

    You might need to generate a manifest as wqweto said. run this

    & mt -nologo -managedassemblyname:EasyXLS.dll -nodependency -out:EasyXLS.manifest

    which is likely enough if it's all deployed in the same folder, you could embed it but it's a signed assembly and it will complain. So in the deployment you would need
    Project1.exe
    EasyXLS.dll
    EasyXLS.manifest
    Last edited by rjsnipe; Apr 14th, 2025 at 08:32 PM.

  16. #16
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    also i notice you use CreateObject. Add the supplied tlb to the project references and then you can strongly type the usage

  17. #17
    Addicted Member
    Join Date
    May 2012
    Location
    42.787034,-81.176367
    Posts
    158

    Re: .Net Com+ DLL in VB6 - RegFree

    Quote Originally Posted by rjsnipe View Post
    that supplied RegSvcs.exe must be made by them to do the registration and likely just calls regasm.
    RegSvcs.exe is a Microsoft utility.

    Code:
    C:\...\v4.0.30319>regsvcs.exe
    Microsoft (R) .NET Framework Services Installation Utility Version 4.8.9037.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    USAGE: regsvcs.exe [options] AssemblyName
    Options:
        /? or /help     Display this usage message.
        /fc             Find or create target application (default).
        /c              Create target application, error if it already exists.
        /exapp          Expect an existing application.
        /tlb:<tlbfile>  Filename for the exported type library.
        /appname:<name> Use the specified name for the target application.
        /parname:<name> Use the specified name or id for the target partition.
        /extlb          Use an existing type library.
        /reconfig       Reconfigure existing target application (default).
        /noreconfig     Don't reconfigure existing target application.
        /u              Uninstall target application.
        /nologo         Suppress logo output.
        /quiet          Suppress logo output and success output.
        /componly       Configure components only, no methods or interfaces.
        /appdir:<path>  Set application root directory to specified path.
    Joe

  18. #18
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    ah i see, my bad. I didn't realise there was a separate .net exe for registering but see now it's for com+ .net.

    If the classes you want to use are deigned to be used in process you should be fine but that depends how they have written it. Can you give an example of the usage of the library?

  19. #19
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    Just to bring it all together.
    If you do the 2 things i detail above it will work with registration free com (I've tested it), however depending on the implementation details of the dll it might not actually do what you need it to if it needs some com+ infrastructure but as wqweto said "it's hard to fathom what gains using it under COM+" so your chances are good. They also have a non com+ dll so if you were really commited to the goal and this does not work, then you could wrap that with your own vanilla com classes for just the bits you need, or more likely just minimise the calls you actually need to do in vb6 and do most of it in .net

  20. #20
    Member
    Join Date
    Jan 2017
    Posts
    43

    Re: .Net Com+ DLL in VB6 - RegFree

    Just to bring it all together.
    If you do the 2 things i detail above it will work with registration free com (I've tested it), however depending on the implementation details of the dll it might not actually do what you need it to if it needs some com+ infrastructure but as wqweto said "it's hard to fathom what gains using it under COM+" so your chances are good. They also have a non com+ dll so if you were really commited to the goal and this does not work, then you could wrap that with your own vanilla com classes for just the bits you need, or more likely just minimise the calls you actually need to do in vb6 and do most of it in .net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width