How do I access a C# assembly from VB?

G

Guest

I know this sounds really basic, but I'm having trouble with this within the
VS.Net 2003 Pro IDE.

I'm working with a VB.Net class library, and I'm having it reference a
compiled assembly (a .dll) in a folder, which was written in C#. Both my
VB.Net class library and the C# assembly contain the same namespace.

After I "Add Reference" the C# assembly to the VB.Net project, the C#
assembly shows up in the list of referenced assemblies in the Solution
Explorer. So far so good.

Within the VB.Net class library I'm attempting to use a couple of classes
implemented in the C# assembly, but neither the IDE nor the VB compiler seem
to see them. I know that both classes are defined within the same namespace
(the same one used in my VB class library), and they are both declared
public. Yet, when I try to access these classes, the compiler acts like it
can't see them. It says they aren't declared.

I also know that these classes are normally accessible, because I use the
same assembly from within my ASP.Net application code (also written in C#),
and it sees these classes just fine.

When I type the namespace into the IDE editor, as in "<namespace>.",
Intellisense just shows me the one class defined within that namespace in my
VB class library. It doesn't see the classes defined in that namespace in
the referenced assembly.

Any ideas? Am I missing something? Is this a bug in VB?

Thanks,

---Mark
 
G

Guest

Okay. Figured it out. It turned out the "Root namespace" setting in the VB
project properties was set to the VB Project's name, rather than the global
namespace I had set up in my VB and C# code. Once I fixed that, then
everything started working.

---Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top