Posts Using CS and VB code files together in App_Code
Post
Cancel

Using CS and VB code files together in App_Code

Many a times you require to use both C-Sharp (C#) and Visual Basic (VB) code class files in the same project.

If you just place your both the code files in your App_Code directly this is the error you’ll see,

“The files ‘/BlogEngine.Web/App_Code/VBCode/Class1.vb’ and ‘/BlogEngine.Web/App_Code/CSCode/Extensions/BreakPost.cs’ use a different language, which is not allowed since they need to be compiled together.”

But you can get this done, here is a very simple way you can try that out,

1) First make two folders in App_code with foldernames as

– CSCode

– VBCode

2) Modify the Web.config with following code:

<compilation debug="false">
 <codeSubDirectories>
 <add directoryName="VBCode" />
 <add directoryName="CSCode" />
 </codeSubDirectories>
</compilation>
This post is licensed under CC BY 4.0 by the author.