ASP.NET app_code中的文件看不到添加到web应用程序中的引用文件



我遇到的问题是,在app_code中有一个类文件没有看到添加到web应用程序的引用。我将引用文件添加到项目中(特别是IBM.Data.Informix),项目文件夹中的aspx.cs页面可以使用"using IBM.Data.FInformix"。然而,当我将using语句添加到类文件中时,它找不到它。

关于如何访问app_code中的类文件,有很多问题,但我一直找不到任何关于这方面的信息。我正在使用VS2012,如果这有区别的话。

当尝试使用未引用的文件时,即使引用在项目文件夹中的aspx.cs文件中也会出现错误:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
Compiler Error Message: CS0246: The type or namespace name 'IBM' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 7:  using System.Net.Mail;
Line 8:  using System.Text;
Line 9:  using IBM.Data.Informix;

Jason p指出的这个问题是,我使用的是App_Code文件夹,它显然是针对网站的,而不是像这样的网络应用,并且文件夹中的代码无法访问引用。

看起来很奇怪,但将类文件移到主文件夹解决了问题。

最新更新