Is it possible to add two language code files i.e.

2019-07-01 11:06发布

问题:

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>