I’ve inherited a VB.NET website and it won’t compile because the class1 in the file class1.vb refers to class2 in a file called class2.vb. I get the following error when trying to compile:
Type Class2 is not defined.
When I look in the object browser the classes are listed separately (i.e. not all grouped under the same namespace) and appear as:
Public Class Class
Inherits System.Object
Member of C:\...\mywebsite\
Code:
Public Class Class1
Public Enum CountType
Morning = 0
End Enum
Public Sub LogError(ByVal exp As Exception, ByVal err As ErrObject, _
ByVal sRoutine As String, _
Optional ByVal sMod As String = "")
End Sub
End Class
Class2.vb
Public Class Class2
Public Enum CountTypes
Morning = 0
Noon = 1
Evening = 2
Night = 3
Other = 4
End Enum
Public Sub LogErrors(ByVal exp As Exception, _
ByVal err As ErrObject, _
ByVal sRoutine As String, _
Optional ByVal sMod As String = "")
Dim cl As Class1 ' error here
End Sub
End Class
I have no idea what the problem was with the project in Visual Studio. I ended up reverting the files in the folder to an earler visual studio project version of the project, letting VS convert to 2008, then getting latest from tfs and it works.