I was wondering if I can merge ASP.Net VB and ASP.Net C#. I made my research and some of the netizens said no here. And this blog and this blog said it is possible. I was wondering if it is possible, how can I access the class of ASP.Net VB to the class of ASP.Net C# from different project?
-
1Nobody says no. You misunderstood what you read - that was about using different languages in the same project. Project or no, in the end you have a reference to an assembly. The language used to create the assembly doesn't matter. If it did, you wouldn't be able to use any NuGet package as they are all built using C# – Panagiotis Kanavos Jun 15 '17 at 10:58
-
1You have to have different projects, one VB.net the other c#. To *access the class of ASP.Net VB from the class of ASP.Net C# project* you simply reference the other project. Please read up on "Project References in Visual Studio" - Google, look at images, follow tutorial of both "solution with VB.net & C# projects" – Jeremy Thompson Jun 15 '17 at 11:00
-
Ignoring the technical aspect, This would be horribly confusing and would mean if your company employed anyone in the future they would have to understand (and more importantly want to work with..) both languages. Pick one and stick to it. – Liam Jun 15 '17 at 11:05
-
@JeremyThompson I will gonna try that. Have you already tried it? – Rich Jun 16 '17 at 01:36
-
@Liam I'm not a fan of VB, and yes my company uses VB and somehow I want to write in C# those new features that my company want to add. – Rich Jun 16 '17 at 02:09
-
Hey, I've been trying it for the last 16yrs in .Net and before that was unmanaged code days... – Jeremy Thompson Jun 16 '17 at 04:25
-
@JeremyThompson ohh. So It is really possible. I will going to try it :) Thanks a lot mate. – Rich Jun 16 '17 at 04:29
3 Answers
If they are in different projects, absolutely... Once compiled .Net assemblies can be referenced and accessed regardless of .Net language.
I don't believe however that you can mix source files in the same project, as both use different compilers to compile to IL.
And finally, if you are talking about uncompiled scripts in App Code folder, I'm not sure. I don't work with uncompiled code files due to security reasons.

- 414
- 1
- 6
- 7
-
If it was in a different project, and it is written in different languages, can I still access all of their classes vice versa? – Rich Jun 16 '17 at 02:12
-
It is possible to convert two different languages project into one. Simply follow these steps:
- Compile VB.Net project
- add library references of compiled project into another project which is in ASP.Net C#
- Now instantiate the object of referenced library in you C# code and you can access all methods of VB.Net project.
Please don't forget to +1 the answer if it helped. Cheers!

- 116
- 10
-
I will definitely try this, if it's successful, I'm going to mark this as an answer – Rich Jun 16 '17 at 02:12
If you are thinking of creating single ASP.NET project from multiple ASP.NET project which are written in different programming language then that is not possible. Here by creating I mean to say including c# file and vb file in a single project.
But if you are going to add reference (dll reference) of those project in a new project then that is possible.

- 1,304
- 11
- 27