Reputation: 2773
I made a new VS 2005 class library project and I added several VB.NET classes into it. However, when i compile the project and import the dll into my other projects, I cannot see my classes.
What do i do wrong, what should I do to add then in the compilation?
Upvotes: 2
Views: 1911
Reputation: 3905
Did you use an explicit access modifier (Public
or Friend
) on your classes in your class library? If not, it will default to Friend
. That means that your classes are only visible within that assembly (class library).
So you might want to make certain specific classes in your class library public:
Public Class MyClass
...
End Class
Edit: As Steven Doggart pointed out, VB.NET classes are public by default. So this might not be an issue unless you explicitly used another access modifier.
Upvotes: 2
Reputation: 43743
There are multiple reasons why that may happen, so without more information, it's impossible to say for sure why, but the most likely reasons which come to mind are:
Public
. If they are declared as Friend
(or as Private
if they are nested types), they will not be visible to other projects that consume that library. The classes should be declared like this: Public Class MyClass
Imports MyClassLibraryNamespace
(but with your actual namespace). To fully qualify the class name inline, you can do it like this: Dim myVariable As New MyClassLibraryNamespace.MyClass
Upvotes: 4