简体   繁体   English

ASP.NET - App_Code - 在同一文件夹中混合 VB 和 C#

[英]ASP.NET - App_Code - Mix VB and C# in the same folder

在此处输入图片说明

I use WebForms type.我使用 WebForms 类型。 and in my website project, there are pages which are using VB and also C#... It works!...在我的网站项目中,有使用 VB 和 C# 的页面......它有效!......

But the problem is, as you can see on the picture above, I put 'cs' file and 'vb' file in 'App_Code' folder, and there are Error appear.....但问题是,如上图所示,我将“cs”文件和“vb”文件放在“App_Code”文件夹中,出现错误.....

The files '/App_Code/BSN3.Class.cs' and '/App_Code/AssemblyInfo.vb' use a different language, which is not allowed since they need to be compiled together.文件“/App_Code/BSN3.Class.cs”和“/App_Code/AssemblyInfo.vb”使用不同的语言,这是不允许的,因为它们需要一起编译。

Ok... I already solved the problem..好的...我已经解决了这个问题..

in Web.Config file, add code在 Web.Config 文件中,添加代码

<compilation debug="false">
    <codeSubDirectories>
        <add directoryName="VBCode" />
        <add directoryName="CSCode" />
    </codeSubDirectories>
</compilation>

And just seperate VB and CS code into two folder which are 'VBCode' and 'CSCode' ..只需将 VB 和 CS 代码分成两个文件夹,分别是“VBCode”和“CSCode”..

so, it will look like this所以,它看起来像这样

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在ASP.Net App_Code文件夹中混合C#和VB.Net - Mixing C# and VB.Net in ASP.Net App_Code folder C#ASP.net如何从后面的代码访问新类,而不是保留在APP_CODE中,而是与后面的代码保留在同一文件夹中 - C# ASP.net How to access new classes from code behind, not kept in APP_CODE, but kept in same folder as code behind app_code文件夹中的asp.net使用类 - asp.net use class in app_code folder 如何在C#项目的App_Code文件夹中一起使用VB.NET类 - How to Using VB.NET classes together in the App_Code folder for C# project 如何从app_code中的类设置母版页中的属性? 与asp.net C# - How to set property in master page from class in app_code? with asp.net c# 为什么我不能在我的代码asp.net c#中使用app_code中的代码文件 - why I can't use code files from app_code in my code asp.net c# 如何在ASP.Net的App_Code文件夹中引用用另一种语言编写的代码? - How can you reference code written in another language in the App_Code folder in ASP.Net? 尝试从vb.net代码引用C#代码,而这两个代码均在app_code子目录中 - Attempting to reference C# code from vb.net code where both are in app_code subdirectories 我可以在ASP.NET网站的CodeFile之外的App_Code的C#文件中使用类/函数吗? - Can I use class/function in C# file in App_Code besides the CodeFile for an asp.net website? ASP.NET C#:如何在 web.config 中调用 App_code 函数 - ASP.NET C#: How can I call App_code functions inside of web.config
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM