Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to import c# classes from dll in a vb.net dll?

  • IDE: VS2010
  • Framework.net: 4.0

I created a c# dll project under Visual Studio 2010, with several public classes, and I would like to use its classes inside another dll project, but written in vb.net.

In the vb.net dll project, I referenced the built c# dll, but impossible to import the c# classes. The namespace of the c# dll is even not recognized.

What must I do to see my c# classes? If this is possible.

Example of class of my c# dll (namespace MyCSharpDll):

namespace MyCSharpNamespace {
  public class MyCSharpClass {
    public void Test() {}
  }
}

Example in a file of my vb.net dll:

Imports MyCSharpDll.MyCSharpNamespace

VS2010 indicates an error saying that MyCSharpDll is unknown or no public member.

Thank you.

like image 609
Alain Avatar asked Dec 13 '22 05:12

Alain


2 Answers

I think you should rewrite your imports

Imports MyCSharpNamespace

without 'MyCSharpDll' part

like image 63
Steve Avatar answered Mar 25 '23 01:03

Steve


You asked: "I created a c# dll project under Visual Studio 2010, with several public classes, and I would like to use its classes inside another dll project, but written in vb.net."

YES you can do it.

Just add to that DLL reference and that's it!

like image 37
Friend Avatar answered Mar 25 '23 02:03

Friend