VB.Net-C# integration RRS feed

  • Question

  • User1504148411 posted
    I have a ASP.net application written in VB.Net which is the main application. I have another ASP.net application written in C#. I want to integrate the C# project files into the VB.net project ( without having to convert C# code to VB.net ) . The C# project contains few aspx pages and couple of C# utility classes. What would be the best way to integrate the C# files into VB.net project and run these successfully within the ASP.net app? Thanks Madhuri Mittal
    Wednesday, August 6, 2003 4:40 AM

All replies

  • User-1792483562 posted
    You can't (as far as I know) have C# and VB.NET files in the same project/assembly. There might be some hack for this but I doubt it... But you can inherit from the other project so that might be an option. Keeping the utility classes in a separate project/assembly and converting the C# aspx.cs-files to VB.NET might be a solution, depending on how much code you have to convert.
    Wednesday, August 6, 2003 10:12 AM
  • User-1844847746 posted
    You can do this, but not through VS.NET. Basically, you need to compile modules (instead of assemblies) and then use the linker (al.exe) to join the two modules into a single assembly. Keep in mind that you will need to do this each and every time you make any change to your code. (Not including changes to your aspx/ascx/asax/asmx files.) Here is a good article that talks about it: http://www.aspalliance.com/Ambrose/Articles/MultifileAssembly.aspx?Print=1
    Wednesday, August 6, 2003 10:47 AM
  • User-1792483562 posted
    So there was a hack (my definition: something probably not worth doing) ;-) ... But since you won't be able to have the files in the same VS.NET project and for the reasons mentioned I guess it's more of a hassle than it's worth. Perhaps something for a future version of VS.NET? Might be a useful feature... Or perhaps one solution is to outlaw VisualBasic.NET altogether and force everyone to use C# - hey, that's a joke, don't bother with the flames! ;-)
    Wednesday, August 6, 2003 11:03 AM
  • User-1305149166 posted
    What's wrong by keeping them as seperate project? When you deploy, copy both DLLs to bin, and all the ASPX/ASCX together. You can even cross referrence each other.
    Wednesday, August 6, 2003 11:26 AM
  • User1504148411 posted
    Thanks. That was good information. Do you know if there is a different way I can tackle this? ie, while deploying I create a subfolder under the main apllication folder in the webserver and copy my dll and files to this folder. When somebody clicks a link the C# application is invoked. Is this doable? Madhuri
    Thursday, August 7, 2003 7:17 AM
  • User808172391 posted

    Hi Madhuri, I am finding out best solution for the same requirement. Did you got anything? What I am thinking is to have iframe in VB.net application calling new c# application. I will be sending parameters to this c# application via querystring. Is this good way to do? Can anybody answer please? 

    Friday, October 2, 2015 10:27 AM