Axe
Axe

Reputation: 6335

Making a DLL in VB.NET which I can use as DllImport

Can I make a DLL in VB.NET which I can use in VB.NET with the tag DllImport just like we import functions from "user32.dll"?

Upvotes: 1

Views: 1035

Answers (2)

bastianwegge
bastianwegge

Reputation: 2498

The outcome of your project, so when you compile and for example debug it are libraries.

  • 1 : Go into Visual Studio
  • 2 : Create a new Project -> "Class Library"
  • 3 : Put some code into your classes
  • 4 : Build it
  • 5 : Search the Debug/Release folder for your DLL

Upvotes: 0

Justin
Justin

Reputation: 86729

No you can't.

The DllImport attribute is used to invoke native / un-managed functions from managed code - VB.Net is managed not native, and so you can't run VB.Net functions through DllImport / P/Invoke.

To use VB.Net functions in other VB.Net projects you should either add a reference to that assembly, use a common referenced interface or base class, or use Reflection.

Upvotes: 3

Related Questions