Is it possible to add two language code files i.e. C# and VB.NET to App_Code? If so, how I could achieve this?

别来无恙 提交于 2019-12-10 20:58:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!