viernes, 22 de junio de 2012

Use C# and VB.net class in the same project

One of the best benefits to my VS.net like is that you can use different programming languages simultaneously. In this case we are talking about VB.net and C #. Net.

It is straightforward to add a form in C # or VB, is as simple as clicking on the project with the right mouse button and select add that we add a form / WebPage language you want.
If we try to do that with a class, we see that not everything works so well.
In this case it will be necessary to do something more.

You shall do the same as before, add, add kind of language we want, put it within the app code in a folder that we create called CScode (for file C #) or VBCode (for VB) depending on language and go to the file "web.config".

Once opened we have to add this fragment:



 </compilation> 
...
    <codeSubDirectories>
        <add directoryName="CSCode"/>
        <add directoryName="CSCode"/>
    </codeSubDirectories>
...
</compilation>


Once done, everything works perfectly and you can make calls between classes of different languages.

I hope you have been helpful.