簡體   English   中英

ASP.NET app_code中的文件無法看到已添加到Web應用程序中的引用文件

[英]File in ASP.NET app_code cannot see referenced file that was added to the web application

我遇到的問題是我在app_code中有一個類文件,但看不到添加到Web應用程序的引用。 我將參考文件添加到項目中(特別是IBM.Data.Informix),並且項目文件夾中的aspx.cs頁面可以很好地“使用IBM.Data.Informix”使用。 但是,當我將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文件夾,並且顯然是針對網站而不是像這樣的Web應用程序使用的,並且該文件夾中的代碼無法訪問引用。

似乎很奇怪,但是將類文件移動到主文件夾解決了該問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM