Multi DLL dependencies

OnTheAnvil

Regular
Joined
Nov 4, 2003
Messages
92
Location
Columbus, Ohio, USA
I'm trying to seperate some of my business logic into DLLs for the first time and I'm hitting some problems. To simplify what I'm trying to do assume I have an new Visual Basic Class Library Project Named "TestApp" with a Car class(car.vb) and a tire class(tire.vb). The car class needs to use the tire class so it has a "Imports TestApp.Tire" at the top.

The problem occurs when I try to compile using vbc.exe
I can compile the tire class into a DLL just fine by running:

vbc /t:library /out:tire.dll tire.vb

but when I try to compile the car class by running:

vbc /t:library /reference:tire.dll /out:car.dll car.vb

I get an error "error BC30002: Type 'TestApp.Tire' is not defined"

The reason I need these to be seperate dll's is because I want to be able to have multiple applications running that use the same car class but each appliction will have it's own version of the tire class. Just for clarification the tire class will always expose the same public methods but it will need to have different variations of the private methods.

So ultimately I'd like to be able to move the car.dll into an application and then place the appropriate tire.dll and have everything work together without having to compile a combined car-tire.dll specifically for each application.

Is this even possible?:confused:

Thanks,
OnTheAnvil
 
I'd never heard of ildasm until you mentioned it so I'm not really sure how to use it. I've loaded my dll into it but I don't know where to find the class name. It looks like it is just called "Tire" but I could use help in finding it. I certainly don't see "TestApp" anywhere. If I double click the manifest icon I see "Tire" but not "TestApp". I hope that helps.

Thanks!
 
I'm having a hard time understanding what's going on here. The topic refers to DLL dependancies. Are the two different classes in the same assembly? Also, it sounds like using an interface or base class for the "Tire" class could simplify things here.
 
PlausiblyDamp,
I tried removing the imports statement but it doesn't work. I also tried "Imports TestApp" that didn't work either.

MarbleEater,
Both .vb files are in the same project and therefore both classes reside in the same namespace. I hadn't considered an interface for this but I still don't know how that would allow me to build the dll's seperately and "reattach" them dynamically. If you have any suggestions I'd love to hear it.

Thanks to both of you for your help.;)
 
I finally got it working last night. I usually do my best work when my eyes are bloodshot and I'm ready to fall asleep. :) I don't know what the solution was but I deleted the entire project and started both classes from scratch. I made sure to not import anything and to reference both classes by their names "Car" and "Tire" not "TestApp.Car" and "TestApp.Tire". When I tried to compile everything it worked. I've also done a little limited testing to make sure I can compile the car class once and then swap in variations of the tire class without any trouble. I've attached the source code in case anyone else has trouble with this.

Thanks to both of you for your help. I've been working on solutions for this for a week.

~OnTheAnvil


---Tire.vb----
Visual Basic:
Public Class Tire
    Private _typeOfTread As String = "Water"

    Public Property typeOfTread() As String
        Get
            Return _typeOfTread
        End Get
        Set(ByVal value As String)
            _typeOfTread = value
        End Set
    End Property
End Class

----car.vb----
Visual Basic:
Public Class Car
    Dim _numTires As Integer = 2
    Dim _carTire As Tire = New Tire()

    Public Property numTires() As Integer
        Get
            Return _numTires
        End Get
        Set(ByVal value As Integer)
            _numTires = value
        End Set
    End Property

    Public Property carTire() As Tire
        Get
            Return _carTire
        End Get
        Set(ByVal value As Tire)
            _carTire = value
        End Set
    End Property
End Class
 
Last edited by a moderator:
Back
Top