问题
While adding two language code files i.e. C# and VB.NET to App_Code, got an error
The files ... file names ... use a different language, which is not allowed since they need to be compiled together.
Is there a way to add two different language files?
回答1:
Create sub folders and put all your VB code in one folder and C# in the other. In your case you will have one for C# and the other one for VB
You will need to modify web.config under the compilation element to include these so that the compiler will know to include them in the compilation
<codeSubDirectories>
<add directoryName="MyVBCode"/>
<add directoryName="MyCSharpCode"/>
</codeSubDirectories>
来源:https://stackoverflow.com/questions/2350398/is-it-possible-to-add-two-language-code-files-i-e-c-sharp-and-vb-net-to-app-cod