There are some libraries written in C# that I would like to use in Visual Basic, but I can't find any tutorials or anything giving me any clues as to how it is done. I have compiled (I think) the library, but I have looked everywhere (including the project properties) for a solution with no success.
-
In your project, add the library (project or binary) as a reference. The former is preferred, as it will allow you to debug the library code. – chue x Dec 29 '13 at 21:51
-
I think adding the dlls will be enough. – AbhinavRanjan Dec 29 '13 at 21:51
-
How do I add the dll files? – xezno Dec 29 '13 at 21:51
3 Answers
If they are in the same solution, just "Add Reference" and select the C# project. If not, compile them into a .dll and "Add Reference" -> select the path to it.
You should then be able to 'Include' / 'Import' methods, classes and objects from the C# projects / libraries.

- 1,930
- 2
- 27
- 47
If you have compiled your C# code into a DLL, you should be able to reference it in a VB.NET project as you would any other DLL. Include your DLL somewhere in your project's folder structure (typically in a "lib" folder), then do the following:
- Open your C# project in Visual Studio.
- Right click on "References" in the Solution Explorer and click on "Add Reference."
- Select the "Browse" tab, then browse to - and select - the desired DLL.
For more information on adding and removing references, visit this article.

- 24,820
- 5
- 68
- 105
You can just add it to your VB.Net project as reference and then use it. Once code is compiled (VB.Net or c#) its in IL(intermediate language) so there is no difference. Look at the example I gave in the answer of following question. I have done exactly what you are asking for.
Can C# compiler compile a VB.Net code?
You can find out how to add reference by going to below URL:
http://msdn.microsoft.com/en-us/library/7314433t(v=vs.90).aspx

- 1
- 1

- 6,755
- 2
- 25
- 39
-
1If you are looking on how to add reference you can go to the msdn link I provided but if you want to understand how c# and vb.net compiler works go to the first (SO) link. – Adarsh Shah Dec 29 '13 at 22:00