- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个网站(不是网络应用程序),它有一个 default.aspx
和 default.aspx.cs
。它有一个 App_Code
文件夹,里面有 A
类。所以 default.aspx.cs
。看起来像:
namespace test1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
和 A
类:
namespace test1
{
public class A
{
_Default mDefaultRef;
public pageLogicIndividual(_Default defaultRef)
{
mDefaultRef = defaultRef;
}
}
}
我可以在 _Default
中使用 A
。例如。如果我在类 _Default
中输入 test1.
,IntelliSense 将显示这两个类。但是,如果我在类 A
中输入 test1.
,IntelliSense 将只显示 A
。为什么我不能在 A
中使用 _Default
?
Error : the type or namespace name does not exist in the namespace (are you missing an assembly reference )
编辑:我会尽力澄清。在类 _Default
所在的 .cs
文件中工作时,我可以键入 test1.
,这是命名空间,智能感知将向我显示类_Default
和类 A
。但是,如果我在类 A
所在的 .cs
文件中工作并键入 test1.
,这是命名空间,那么智能感知将只显示 A
类。
最佳答案
我过去曾遇到过这种挑战。
在 Visual Studio 中打开 App_Code 文件夹节点。右键单击相关类,然后单击属性
在属性 Pane 中,将构建操作更改为编译。
现在应该可以正常工作了。
关于c# - 无法从 app_code 访问类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25624126/
我在 C#.net 中制作了一个 webapplication 并制作了一个 app_code 文件夹,其中创建了一个文件 命名为“SessionHelper.cs”(属性正确设置为“编译”,以便它可
我已将我的一个类移动到 App_Code 文件夹(和命名空间),并且在该类内部我有一个对全局资源的引用: using Res = myProjectName.App_GlobalResources.V
我正在我的 App_Code 文件夹中创建多个子文件夹来组织我的类(class),它似乎工作正常,对此有什么限制吗? 喜欢: 应用代码 用户界面 文本框 标签 最佳答案 我找到了 this寻找有关 A
我的 App_Code 文件夹有一个“小”问题。 我正在学习 ASP.NET,因此订购了一个支持 ASP.NET 4.0 的网络服务器。我正在使用 Visual Web Developer 对我的网页
所以我在设计的新网站上的 App_Code 文件夹遇到了一个非常奇怪的问题。 我在 App_Code 文件夹的命名空间内有一个基本类。当我设置命名空间并从该类创建一个对象时,IDE 中的一切工作正常。
我们有一个网站,其中有大量缓存对象存储在 App_Code 的静态变量中。每当我们将 App_Code 更改推送到我们的生产网络服务器时,它都会回收 IIS 池并刷新缓存。但是,当我们推出对 .asp
这个问题困扰了我一段时间: Could not load file or assembly 'app_code' or one of its dependencies. The system cann
我正在尝试创建在 Web 站点项目 中定义的类型的实例。类型名称是可配置的,因此是已知的,但对于程序集名称,无法在配置时告知名称,因为网站项目是由 ASP .Net 编译的。 var typeName
第一季度 A) 我创建了一个新的 .cs 文件,在其中声明了一个类,然后将其保存在我的光盘上。现在根据我的书,我应该能够将此文件导入网站应用程序的 App_Code 文件夹中(通过网站 --> 添加现
我的名字是 samy,我快疯了! 我遇到了这个问题,我的类在 app_code 中在我将它们上传到服务器后不可见。本地一切正常。 当很多答案都是这样的时候,我读了一些关于这个的其他问题: “右键单击解
我在 ASP.NET C# 中创建了一个类,它位于 App_Code 文件夹中。现在我想从我的一个 .aspx 页面的代码后面调用这个类。我该怎么做? 任何帮助将不胜感激。 最佳答案 我假设您无法从代
我有一个网站(不是网络应用程序),它有一个 default.aspx 和 default.aspx.cs。它有一个 App_Code 文件夹,里面有 A 类。所以 default.aspx.cs。看起
当我将类文件放入我的 App_Code 文件夹的子文件夹中时,出现以下错误: errorCS0246:找不到类型或命名空间名称“MyClassName”(是否缺少 using 指令或程序集引用?) 这
我在项目的 App_code 文件夹中编写了一个名为 ArchivedFilesWrapper 的类,但是当我在不同文件夹中的另一个文件中使用此类时,出现错误: 找不到类型或 namespace 名称
我在 ASP.NET 中创建了一个网站,并创建了一个类并将其放在 App_Code 文件夹中。但是我无法从我的其他页面访问它。是否需要配置一些东西来允许这样做?我已经在以前的项目中使用它,但不知何故在
我在 asp.net 网站的 app_code 文件夹中有一个类 Customer,如何使用反射创建实例,例如使用 Activator.CreateInstance(assemblyName, typ
我有一个基于 .NET 4.0 ASP.net 项目模板的网站。突然间,当我重建我的解决方案时,App_Code 目录需要 3-4 分钟的时间来编译(基于输出窗口中显示的内容)。这个目录中只有大约 1
我为我的 Web 项目创建了几个类,我将把它们存储在 App_Code 文件夹中。我不想将所有类存储在顶层(无命名空间),但想将它们组织到命名空间中。到目前为止,这似乎不可能,因为当我使用“using
我用VS2010制作了一个网站,并在IIS7上发布。它运行良好,但无法连接到 OLAP 服务器,因此我必须设置模拟。模拟在我的开发机器上的调试中运行良好,但是当我在服务器上发布它时,我收到此错误*:
我在“App_Code”文件夹中的文件中有一个类。我可以在“aspx”文件中使用它,但不能在代码隐藏文件中使用它。如何使其对隐藏代码可见? 注意:这是 Mono 上的 ASP.Net,我直接编写类,而
我是一名优秀的程序员,十分优秀!