3

my team needs to have the same application deployed in two different folders on the same server but with slightly different code. We'd like to have a base code on the folder A, and a version with a few changes on the folder B.

I'm trying to understand if this is something we could achieve in VB6 and here's what I'm currently working on.

First, I've created a class project (Project2) with one class in it (Class1.cls):

Option Explicit

Public Function WeirdMath(Num1 As Double, Num2 As Double) As Double
    WeirdMath = Num1 + Num2
End Function

Then I've created a standard exe project (Project1) which has Project2 as reference. In the exe project I've created a form with two textboxes, a label and a button.

Option Explicit

Private wm As New Class1

Private Sub Command1_Click()
    Dim Num1 As Double
    Dim Num2 As Double

    Num1 = IIf(IsNumeric(Text1.Text), Text1.Text, 0)
    Num2 = IIf(IsNumeric(Text2.Text), Text2.Text, 0)
    Label1.Caption = wm.WeirdMath(Num1 , Num2)
End Sub

I've built the two projects in the folder \bin1 and registered the Project2.dll in that folder. Then I've changed the Class1.cls code to

Public Function WeirdMath(Num1 As Double, Num2 As Double) As Double
    WeirdMath = Num1 - Num2
End Function

and built the two projects in the \bin2 folder along with this Project1.exe.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
    <assemblyIdentity name="Project1" version="1.0.0.0" type="win32"/>
    <file name="Project2.dll"/>
</assembly>

I was expecting the bin1\Project1.exe to make the sum of two numbers while bin2\Project1.exe would be doing the difference.

Does it make any sense? Is it even possible for COM dlls to work this way?

trick
  • 78
  • 1
  • 9
  • 2
    The manifest is inadequate. In only states that you have a dependency on project2.dll, it is missing the `comClass` elements that say what COM classes are implemented by project2. Getting this right for vb6 is not so easy, you need to know the guids. [Look here](https://stackoverflow.com/questions/465882/generate-manifest-files-for-registration-free-com). – Hans Passant Apr 11 '18 at 13:45
  • 1
    That was it. Easier than I thought. I've added this **** and it started to work as expected. Thanks a mil! – trick Apr 11 '18 at 14:12

0 Answers0